Extends bindable.Object
See Also views.Base, models.Base, templates

Your Mojo application entry point. This module ties everything together, and allows other parts of your application to communicate with each other. This should be your only singleton.


npm install mojo-application --save-exact

Playground Example

Here's an example of how to use just about every property / method in the Application class.


Your main application entry point.

  • properties - properties to set on the application
    • nodeFactory - (optional) the node factory to use for creating views. Automatically set depending on the platform.


The pre-defined application instance. This is the default application when the application parameter is omitted from the View(properties[, application]), and Model(properties[, application]) classes. Useful if you want a global reference to an application.


The plugins to register when initializing the application. See playground example for usage.


The node factory to use for rendering the DOM



method to initialize the application. This method calls willInitialize, and didInitialize. it also emits an initialize event.

override willInitialize()

called immediately before initializing the application

override didInitialize()

called immediately after initializing the application


  • initialize - emitted when the application initializes

Extended API

Below are a list of extensions to mojo applications.


Property added by views extension when registering to the application.

views.register(classesOrClassName[, class])

Registers a view class that's accessible anywhere in the application. This is especially useful when registering reusable components you might want to use in something like paperclip components.

  • classesOrClassName - classes, or class name
  • class - the class if className is provided

var Application = require("mojo-application@0.1.x"),
views = require("mojo-views@0.2.x");

var app = new Application();
app.views.register("someViewName", views.Base);
  someViewName: views.Base,
  someOtherView: views.Base.extend({
    paper: require("./someTemplate.pc")

views.create(className, properties)

Creates a new registered view.

  • className - the className of the view you want to create
  • properties - the properties to assign to the created class


Registers a view plugin. This is useful if you want to extend the functionality for each view. Super useful for interpolation between different libraries. Here's an example of paperclip using the handlebars template engine:


Property added by models extension when registering to the application.

models.register(classesOrClassName[, class])

Registers a globally accessible model class. Similar to how views.register(...) works.

  • classesOrClassName - classes, or class name
  • class - the class if className is provided

models.create(className, properties)

Creates a new registered model. Similar to how models.register(...) works.


Registers a model extension. Works exactly like view extensions.


Added property by the animator. The animator plugin leverages the browsers native requestAnimationFrame function to update the DOM. It's used in views, and templates.


Added property from mojo-router. See HTTP Router docs for usage.


Added property. See paperclip template extension for more details.