最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Marionette - initialize event not firing - Stack Overflow

programmeradmin2浏览0评论

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?

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?

Share Improve this question asked Jun 29, 2014 at 22:55 bertdaybertday 11k15 gold badges66 silver badges98 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 17

Which version of marionette are you using?

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

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();
        }
    */
});
发布评论

评论列表(0)

  1. 暂无评论