Lateralus

Lateralus

Lateralus

Constructor

new Lateralus(el)

You should not need to call the Lateralus constructor directly, use Lateralus.beget instead. To create a new Lateralus app:

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

Component
Model
Router

Mixins

mixins

Members

$el :jQuery

The jQuery Object that contains Lateralus#el.

Source:
Type:
  • jQuery

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:

el :HTMLElement

The DOM node that contains this Lateralus instance.

Source:
Type:
  • HTMLElement

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 Lateralus instance.

const ExtendedComponent = Lateralus.Component.extend({
  name: 'extended',

  lateralusEvents: {
    anotherComponentChanged: 'onAnotherComponentChanged',

    anotherComponentDestroyed: function () {
      // ...
    }
  },

  onAnotherComponentChanged: function () {
    // ...
  }
});
Mixes In:
Default Value:
  • undefined
Source:
Type:
  • Object | undefined

model :Lateralus.Model

Maintains the state of the central Lateralus instance.

Source:
Type:

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 Lateralus.mixins#collect calls. Each of the functions attached to this Object should return a value. These functions must be completely synchronous.

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 Lateralus application instance.

var App = Lateralus.beget(function () {
  Lateralus.apply(this, arguments);
});
Source:
Parameters:
Name Type Attributes Description
child function
config Object <optional>
Name Type Attributes Description
Model LateralusModel <optional>

A Lateralus.Model subclass constructor to use for Lateralus.model instead of a standard Lateralus.Model.

Returns:
Type:
function

The created Lateralus subclass.

(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.

dispose()

Remove this Lateralus app from memory.

Source:

error(…Any)

Cross-browser friendly wrapper for console.error.

Source:
Parameters:
Name Type Attributes Description
Any any <repeatable>

parameters to pass along to console.error.

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 initialize method.

Returns:
Type:
Lateralus.Router

An instance of the provided Router constructor.

log(…Any)

Cross-browser friendly wrapper for console.log.

Source:
Parameters:
Name Type Attributes Description
Any any <repeatable>

parameters to pass along to console.log.

shareWith(receiver, providerName)

Relay Lateralus.mixins.provided handlers to another Lateralus instance. This is the Lateralus.mixins.provide analog to Lateralus.mixins.amplify.

Source:
Parameters:
Name Type Description
receiver Lateralus

The Lateralus instance to share Lateralus.mixins.provided handlers with.

providerName string

The name of the Lateralus.mixins.provideer.

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 console.warn.