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

Commit 71031ea

Browse files
committed
Adding TVMLKit support (debug-js/debug#579)
1 parent 2b162bb commit 71031ea

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/browser.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export function inject (createDebug) {
100100
load () {
101101
let namespaces
102102
try {
103-
namespaces = createDebug.storage.debug
103+
namespaces = createDebug.storage.getItem('debug')
104104
} catch (error) {}
105105

106106
// If debug isn't set in LS, and we're in Electron/nwjs, try to load $DEBUG
@@ -138,7 +138,7 @@ export function inject (createDebug) {
138138
if (namespaces == null) {
139139
createDebug.storage.removeItem('debug')
140140
} else {
141-
createDebug.storage.debug = namespaces
141+
createDebug.storage.setItem('debug', namespaces)
142142
}
143143
} catch (error) {}
144144
},
@@ -155,7 +155,9 @@ export function inject (createDebug) {
155155
*/
156156
storage: (() => {
157157
try {
158-
return window.localStorage
158+
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
159+
// The Browser also has localStorage in the global context.
160+
return localStorage
159161
} catch (error) {}
160162
})(),
161163

0 commit comments

Comments
 (0)