Constructor
new Lateralus(el)
You should not need to call the Lateralus constructor directly, use
instead. To create a new Lateralus app:Lateralus.beget
var App = Lateralus.beget(function () {
// Don't forget to call the Lateralus constructor!
Lateralus.apply(this, arguments);
});
var app = new App(document.getElementById('app'));
- Mixes In:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
el |
Element
|
The DOM element that contains the entire Lateralus app. |
Classes
Mixins
Members
components :Object.<Lateralus.Component>
The subcomponents belonging to this object. Do not modify this property directly, it is managed by Lateralus.
- Mixes In:
- Source:
Type:
-
Object.<Lateralus.Component>
globalPartials :Object.<String>
An optional map of template partials to be passed to the
Mustache.render
call for all Views belonging to this Lateralus app.
- Source:
Type:
-
Object.<String>
globalRenderData :Object.<String>
An optional map of template render data to be passed to the
Mustache.render
call for all Views belonging to this Lateralus app.
- Source:
Type:
-
Object.<String>
lateralusEvents :Object|undefined
A map of functions or string references to functions that will
handle events dispatched to the
central
instance.Lateralus
const ExtendedComponent = Lateralus.Component.extend({
name: 'extended',
lateralusEvents: {
anotherComponentChanged: 'onAnotherComponentChanged',
anotherComponentDestroyed: function () {
// ...
}
},
onAnotherComponentChanged: function () {
// ...
}
});
- Mixes In:
- Default Value:
- undefined
- Source:
Type:
-
Object
|undefined
modelEvents :Object|undefined
A map of functions or string references to functions that will
handle events emitted by
this.model
.
const ExtendedComponent = Lateralus.View.extend({
modelEvents: {
changed:someProperty: function (model, someProperty) {
// ...
}
}
});
- Mixes In:
- Default Value:
- undefined
- Source:
Type:
-
Object
|undefined
provide :Object|undefined
A map of functions that will handle
calls. Each of the functions attached to this Object should return a
value. These functions must be completely synchronous.Lateralus.mixins#collect
const App = Lateralus.beget(function () {
Lateralus.apply(this, arguments);
});
_.extend(App.prototype, {
provide: {
demoData: function () {
return 1;
}
}
});
const app = new App();
const ComponentSubclass = Lateralus.Component.extend({
name: 'provider',
provide: {
demoData: function () {
return 2;
}
}
});
app.addComponent(ComponentSubclass);
console.log(app.collect('demoData')); // [1, 2]
- Mixes In:
- Source:
Type:
-
Object
|undefined
Methods
(static) beget(child, configopt) → {function}
Create a
application instance.Lateralus
var App = Lateralus.beget(function () {
Lateralus.apply(this, arguments);
});
- Source:
Parameters:
Name | Type | Attributes | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
child |
function
|
||||||||||
config |
Object
|
<optional> |
|
(static) inherit(child, parent) → {function}
Set up the prototype chain between two objects.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
child |
function
|
|
parent |
function
|
Returns:
- Type:
-
function
A reference to the passed-in child
parameter.
error(…Any)
Cross-browser friendly wrapper for console.error
.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
Any |
any
|
<repeatable> |
parameters to pass along to |
initRouter(Router, optionsopt) → {Lateralus.Router}
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
Router |
Lateralus.Router
|
A constructor, not an instance. |
|
options |
Object
|
<optional> |
To be passed to the Router
|
log(…Any)
Cross-browser friendly wrapper for console.log
.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
Any |
any
|
<repeatable> |
parameters to pass along to |
shareWith(receiver, providerName)
Relay
d handlers to another Lateralus.mixins.provide
instance. This is the Lateralus
analog
to Lateralus.mixins.provide
.Lateralus.mixins.amplify
- Source:
Parameters:
Name | Type | Description |
---|---|---|
receiver |
Lateralus
|
The |
providerName |
string
|
The name of the |
toString() → {string}
Do not override this method, it is used internally.
- Source:
Returns:
- Type:
-
string
This is "lateralus"
.
warn(…Any)
Cross-browser friendly wrapper for console.warn
.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
Any |
any
|
<repeatable> |
parameters to pass along to |