1. Home
  2. Docs
  3. Application Framework
  4. Javascript Framework
  5. Events

Events

mwp.on(event, callback)

The core MWP Javascript Framework triggers various events on the mwp namespace to provide extra flexibility when bootstrapping modules. Use mwp.on(event, callback) to assign callbacks.

@Events


mwp.on( 'controller.model', function( controller, name ) {} )

Occurs just after any controller is defined.

Params

controller The controller model which was defined
name The name of the controller

mwp.on( 'controller.model', function( controller, name ) {

});

mwp.on( name + '.controller.model', function( controller ) {} )

Occurs just after an individual controller is defined.

Params

controller The controller model which was defined

mwp.on( 'vendor-controller-name.controller.model', function( controller ) {

});

mwp.on( 'model', function( model, name ) {} )

Occurs just after any model is defined.

Params

model The model which was defined
name The name of the model

mwp.on( 'model', function( model, name ) {

});

mwp.on( name + '.model', function( model ) {} )

Occurs just after any individual model has been defined.

Params

model The model which was defined

mwp.on( 'vendor-model.model', function( model ) {

});

mwp.on( 'init.controllers', function() {} )

Occurs when the page has loaded. All controllers are instantiated on this event.

Params

None

mwp.on( 'init.controllers', function() {

});

mwp.on( name + '.instance', function( controller ) {} )

Occurs when an individual controller has been instantiated, but before it has been initialized using its init method.

Params

controller The controller instance

mwp.on( 'vendor-controller-name.instance', function( controller ) {

});

mwp.on( name + '.init', function( controller ) {} )

Occurs after an individual controller has completed its initialization process.

Params

controller The controller instance

mwp.on( 'vendor-controller-name.init', function( controller ) {

});

mwp.on( 'mwp.ready', function() {} )

Occurs after the page has loaded and all controllers have been initialized.

Params

None

mwp.on( 'mwp.ready', function() {

});

mwp.on( 'views.ready', function() {} )

Occurs just after all bindings on views present on the page have been processed. This indicates that all of the data and functionality has been injected into the page.

Params

None

mwp.on( 'views.ready', function() {

});
Was this article helpful to you? Yes No

How can we help?