-
Notifications
You must be signed in to change notification settings - Fork 0
appentry
#Start up your application
How to catch a app onStart or launch event and add self start up implementation?
##Start up
While app initialised, JQMVC will find a way to start up app.
First of all, if a launch function is defined in app init JSON object, it will be called
mvc.app.init({
launch : function(msgObj) {
//your start up implementation here
}
});
If launch function is not defined, JQMVC will invoke message defined in onStart field.
mvc.app.init({
onStart:{
controller:myController,
method:methodName
}
});
In the case above, JQMVC will call method "methodName" defined in controller: "myController".
JQMVC will throw an error to console if method or controller cannot be found.
The onStart field could be over-written by putting arguments in the URL whose format is:
http://domain.com/path/to/your/entry/file.html?_ctl=myController&_act=methodName
In this case, no matter onStart field is defined in app initilise or not, JQMVC will invoke method specified in URL.
If both launch and onStart is defined in app.init, the name of controller and method will be passed to launch function as Message Object whose structure is:
//msgObj (message object) in launch function
{
controller:controllerName,
method:methodName
}