app.js revision 19c9aa5b31ebb72417f108635129316c1cbf2fd4
/**
* The application framework provides a main application controller
* that can host multiple navigation controllers, each which can
* navigate to multiple views and keeps state about where it is
* in the navigation scheme. It provides a simple rendering framework
* that is asynchronous and not DOM focused. It ties into the
* history manager to manage the nav state when this feature is
* available.
* @module app
* @since 3.4.0
* @requires base-base
* @optional history
* @beta
*/
/**
* The application control handles the application level
* functional in the framework. In addition to hosting
* the various nav controls for the app, it handles saving
* state since that needs to be centralized.
* @class App
* @constructor
* @param o The configuration options
* @extends Base
* @uses RenderTarget
*/
var DEFAULT = {},
APP_STATE_CHANGE = 'appStateChange',
CURRENT_VIEW_ID = 'currentViewId',
DEFAULT_VIEW_ID = 'defaultViewId',
ID = 'id',
PARENT = 'parent',
STATE_DELIMITER = 'stateDelimiter',
VIEW_STATE = 'viewState',
App = function(o) {
};
/**
* The app control id
* @attribute id
* @type string
*/
/**
* to determine if it is okay to operate. Not
* currently modified by the app framework.
* @attribute modal
* @type bool
* @default false
*/
/**
* The id of a nav control that has focus
* Not currently modified by the app framework.
* @attribute modalFocus
* @type string
*/
/**
* A function used to render whatever scaffolding
* the app control plumbs in. This might be nothing,
* or it could be a container for the various app
* controls.
* @attribute renderer
* @type function
*/
};
/**
* Executed when the appState attribute is updated. This notifies
* all nav controllers and the current view that the state change
* happened.
* @method _stateChangeNotifier
* @param {Event} e the change event
* @param e.newVal the new state
* @param e.prevVal the old state
* @private
*/
_stateChangeNotifier: function(e) {
for (i in navs) {
if (navs.hasOwnProperty(i)) {
}
}
},
initializer: function() {
if (Y.History) {
/**
* History control instance
* @property history
*/
} else {
}
/**
* Hash of navigation controls
* @property navs
*/
this.navs = {};
},
/**
* Add a nav control instance to this app control
* @method addNav
* @param nav {Nav} a nav control to add
* @return {App} the app control
* @chainable
*/
var self = this,
// Y.log('change- ' + e.newVal + ',' + (e.prevVal||''), 'info', 'app');
});
return nav;
},
/**
* Remove a nav control from this app control instance
* @method removeNav
* @param nav {string|Nav} a nav control to remove
* @return {Nav} the removed nav control
*/
}
},
/**
* Save the current state of the application. This happens automatically
* when a nav controller navigates to a new view, but it can also be
* called directly if updating the extra state for a view.
* @method save
* @property nav {Nav} a navigation control
* @property view {View} a view control
* @return {App} The app control
* @chainable
*/
if (xtra) {
}
if (this.history) {
}
} else {
}
return this;
}
});
// Modality control
// Visibility/focus of nav controllers?
// State change Orientation change / view size - implementer
// The app controller is DOM agnostic code for the most part