Main entry point to mojo-based applications. Not very complex - just some glue to help bootstrap your application.
Installation
npm install mojo-application
Examples
See Also
- bindable.js - base class for application
- mojo-views
- mojo-models
- mojo-router
- mojo-bootstrap
API
Application(options)
Extends bindable.Object
options
nodeFactory
- the node factory to use when creating elements. This is automatically set when undefined.
// node factoryvar nofactor = Application = ; // use the DOM node factory - meant for the browservar app = nodeFactory: nofactordom ; // use the string node factory - meant for node.jsvar app = nodeFactory: nofactorstring ; // use the default node factory - automatically identified based on platform.var app = nodeFactory: nofactor"default" ;
application.nodeFactory
the node factory to use when creating elements. This allows us to run on multiple platforms.
application.plugins
Array of plugins to use in the application.
var Application = ; var MyApplication = Application; var app = ;
application.use(plugin)
registers a plugin to the application.
var Application = ;var app = ; // load in a third-party pluginapp; // or pass in a functionapp;
application.initialize(options)
Initializes the application. This is where you should pass-in your app config, including what element to attach to.
Note that an exception will be thrown if initialize is called more than once.
var app = ;app; app;
application.willInitialize(options)
called immediately before initializing your application.
application.didInitialize(options)
called immediately after initializing your application. Good place to start your application.
var MyApplication = Application; var app = ;app;
events
initialize
- emitted when the application is initialized