diff --git a/source/Ox.UI/js/Core/App.js b/source/Ox.UI/js/Core/App.js index 7452b882..47623fcf 100644 --- a/source/Ox.UI/js/Core/App.js +++ b/source/Ox.UI/js/Core/App.js @@ -3,12 +3,12 @@ /*@ Ox.App Basic application instance that communicates with a JSON API ([options]) -> App object - load app loaded + load App loaded options Options object - timeout request timeout - type HTTP Request type, i.e. 'GET' or 'POST' - url JSON API url - self Shared private variable + name App name + timeout Request timeout + type HTTP Request type, i.e. 'GET' or 'POST' + url JSON API URL @*/ Ox.App = function(options) { @@ -24,17 +24,14 @@ Ox.App = function(options) { }, that = Ox.Element({}, Ox.extend({}, self)); - //@ api api endpoint + //@ api API endpoint that.api = Ox.API({ type: self.options.type, timeout: self.options.timeout, url: self.options.url }, function() { that.api.init(getUserData(), function(result) { - //Ox.UI.hideLoadingScreen(); - that.triggerEvent({ - load: result.data - }); + that.triggerEvent({load: result.data}); }); }); @@ -43,15 +40,9 @@ Ox.App = function(options) { function getUserData() { return { - document: { - referrer: document.referrer - }, - history: { - length: history.length - }, - location: { - href: location.href - }, + document: {referrer: document.referrer}, + history: {length: history.length}, + location: {href: location.href}, navigator: { cookieEnabled: navigator.cookieEnabled, plugins: Ox.toArray(navigator.plugins).map(function(plugin) { @@ -72,13 +63,21 @@ Ox.App = function(options) { }; } + function update() { + // ... + } + /*@ - options get/set options, see Ox.getset - () -> get options - (options) -> update/set options + options Gets or sets options (see Ox.getset) + () -> All options + (key) -> <*> The value of option[key] + (key, value) -> Sets one option, returns App object + ({key: value, ...}) -> Sets multiple options, returns App object + key The name of the option + value <*> The value of the option @*/ that.options = function() { - return Ox.getset(self.options, Array.prototype.slice.call(arguments), self.change, that); + return Ox.getset(self.options, arguments, update, that); }; return that;