diff --git a/source/Ox/js/Core.js b/source/Ox/js/Core.js index ce435dea..7a5ae6c9 100644 --- a/source/Ox/js/Core.js +++ b/source/Ox/js/Core.js @@ -133,10 +133,7 @@ Ox.localStorage localStorage wrapper ({key, val}) -> localStorage object @*/ Ox.localStorage = function(namespace) { - // Ox.Log calls this before Ox.isUndefined is defined - if (localStorage === void 0) { - localStorage = {}; - } + window.localStorage = window.localStorage || {}; function storage(key, val) { var ret, value; if (arguments.length == 0) { @@ -146,9 +143,10 @@ Ox.localStorage = function(namespace) { ret[key.substr(namespace.length + 1)] = JSON.parse(val); } }); - } else if (arguments.length == 1 && !Ox.isObject(key)) { + } else if (arguments.length == 1 && typeof key == 'string') { + // This gets called by Ox.Log before Type.js has loaded value = localStorage[namespace + '.' + key]; - ret = Ox.isUndefined(value) ? void 0 : JSON.parse(value); + ret = value === void 0 ? void 0 : JSON.parse(value); } else { args = Ox.makeObject(arguments); Ox.forEach(args, function(val, key) { @@ -174,7 +172,7 @@ Ox.Log Logging module @*/ Ox.Log = (function() { var storage = Ox.localStorage('Ox'), - log = storage('Log') || {filter: [], filterEnabled: true}, + log = storage('log') || {filter: [], filterEnabled: true}, that = function() { var ret; if (arguments.length == 0) { @@ -188,7 +186,7 @@ Ox.Log = (function() { if (!Ox.isUndefined(val)) { that.filter.enable(); log.filter = Ox.toArray(val); - storage('Log', log); + storage('log', log); } return log.filter; }; @@ -197,11 +195,11 @@ Ox.Log = (function() { }; that.filter.disable = function() { log.filterEnabled = false; - storage('Log', log); + storage('log', log); }; that.filter.enable = function() { log.filterEnabled = true; - storage('Log', log); + storage('log', log); }; that.filter.remove = function(val) { val = Ox.toArray(val);