Skip to content
This repository has been archived by the owner on Dec 28, 2021. It is now read-only.

Commit

Permalink
Adding TVMLKit support (debug-js/debug#579)
Browse files Browse the repository at this point in the history
  • Loading branch information
miaulightouch committed Aug 11, 2018
1 parent 2b162bb commit 71031ea
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export function inject (createDebug) {
load () {
let namespaces
try {
namespaces = createDebug.storage.debug
namespaces = createDebug.storage.getItem('debug')
} catch (error) {}

// If debug isn't set in LS, and we're in Electron/nwjs, try to load $DEBUG
Expand Down Expand Up @@ -138,7 +138,7 @@ export function inject (createDebug) {
if (namespaces == null) {
createDebug.storage.removeItem('debug')
} else {
createDebug.storage.debug = namespaces
createDebug.storage.setItem('debug', namespaces)
}
} catch (error) {}
},
Expand All @@ -155,7 +155,9 @@ export function inject (createDebug) {
*/
storage: (() => {
try {
return window.localStorage
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
// The Browser also has localStorage in the global context.
return localStorage
} catch (error) {}
})(),

Expand Down

0 comments on commit 71031ea

Please sign in to comment.