App
Summary
The App class defines the main object of the applications
Constructor
App
Syntax
App
(
private
-
options
Summary
Parameters:
-
options
ObjectAn object defining options for the application.
- views - An array with a list of view names
Methods
back
Syntax
back
()
chainable
Summary
Go to the previous view in the history
Returns:
Route
Example:
m.app.back();
go
Syntax
go
(
-
url
Summary
Go to an url
Parameters:
-
url
StringThe url to go
Returns:
Route
Example:
m.app.go("/product/15/");
on
Syntax
on
()
chainable
Summary
Set callbacks for app events
Returns:
App instance
Example:
m.app.on("ready", function(self) {
console.log("App started.");
});
settings
Syntax
settings
(
-
key
-
[value]
Summary
Application settings If called with a key, returns the value. If called with key and value, sets value to key.
Parameters:
-
key
StringThe name of the setting
-
[value]
Object optionalThe value of the setting
Returns:
object the setting value
Example:
m.app.settings("debug", true);
if (m.app.settings("debug") === true) {
console.log("Debug mode activated.");
}
version
Syntax
version
(
String
-
[version]
Summary
The application's version number Note: It's not Mootor version, this value is defined in application code, not framework code.
Parameters:
-
[version]
String optionalThe version number or name
Returns:
String:
Version number or name
Example:
m.app.version("beta1");
if (m.app.version().indexOf("beta") > -1) {
console.log("Warning: beta version")
}
view
Syntax
view
(
-
id
-
[options]
Summary
Create or get a view
Parameters:
-
id
StringThe id of the view
-
[options]
String optionalThe options object for the view
Returns:
View the referenced view object
Example:
indexView = m.app.view("index");