Skip to content

Commit

Permalink
Add TVMLKit support (#579)
Browse files Browse the repository at this point in the history
* Adding TVMLKit support

* removed the check for window/navigationDocument, instead relying on localStorage in the global context on all 'browser' based platforms
  • Loading branch information
febbraro authored and TooTallNate committed Jun 21, 2018
1 parent 1ad1e4a commit 02b9ea9
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 @@ -126,7 +126,7 @@ function save(namespaces) {
if (null == namespaces) {
exports.storage.removeItem('debug');
} else {
exports.storage.debug = namespaces;
exports.storage.setItem('debug', namespaces);
}
} catch(e) {}
}
Expand All @@ -141,7 +141,7 @@ function save(namespaces) {
function load() {
var r;
try {
r = exports.storage.debug;
r = exports.storage.getItem('debug');
} catch(e) {}

// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
Expand All @@ -165,7 +165,9 @@ function load() {

function localstorage() {
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 (e) {}
}

Expand Down

0 comments on commit 02b9ea9

Please sign in to comment.