bertday
bertday

Reputation: 10971

Marionette - initialize event not firing

I'm have a basic Marionette app that looks like:

var App = new Marionette.Application();

App.on('initialize:after', function () {
    console.log('init');
});

App.start();

When I run this nothing gets printed to the console. However, if I add

App.on('start', function () {
    console.log('start');
});

then it prints start. Does anyone know how to get the former to work?

Upvotes: 5

Views: 3215

Answers (2)

Ramon Caldeira
Ramon Caldeira

Reputation: 236

Which version of marionette are you using?

initialize:after has been renamed to start after version 1.0.0. See the changelog.

Upvotes: 17

zloctb
zloctb

Reputation: 11177

In Marionette 3, the events that are currently triggered, are:

  • "before:start" / onBeforeStart: fired just before the Application starts and before the initializers are executed.
  • "start" / onStart: fires after the Application has started and after the initializers have been executed.

var MyApp =  ContactManager = new Backbone.Marionette.Application();

MyApp.on("before:start", function(options){
    options.moreData = "Yo dawg, I heard you like options so I put some options in your options!";
});

MyApp.on("start", function(options){
    console.log(options)
    /*
        if (Backbone.history){
            Backbone.history.start();
        }
    */
});

Upvotes: 0

Related Questions