Backbone Marionette模块已弃用,处理初始化程序和启动事件的好方法是什么?

Joh*_*der 5 javascript requirejs backbone.js marionette

就像我的标题所说的那样,我确实看到Marionette Module现在已被弃用,我们应该使用requirejs来代替AMD模块.这很好,除了模块之外的所有内容都有很好的处理初始化程序和之前:启动和启动事件的目的.它允许我轻松地设置我的区域,视图和集合.现在处理这个的替代方法是什么?

下面是我将使用的代码示例:

define(['core', './views/mainView'], function(core, mainView) {
    var app = core.app;
    app.start();

return core.app.module('Home Page Module', function(Module) {
    Module.addInitializer(function() {
        this.region = new core.Marionette.Region({
            el: '#page-container'
        });
        this.collection = [];
    });

    Module.on('start', function() {
        this.view = new mainView({
            collection: this.collection
        });
        this.region.show(this.view);
    });
});
});
Run Code Online (Sandbox Code Playgroud)

bda*_*xyz 2

我没有答案,但 Marionette 的创造者 Derick Bailey 有。

\n\n
\n

没有子应用程序启动/停止的问题尚未出现在我的应用程序中。我现在不需要\xe2\x80\x99。不过,我知道我会需要它,当我再次遇到该要求时,我\xe2\x80\x99会找到另一个解决方案。\xe2\x80\x99s 有一个很好的机会,我\xe2\x80\x99 将为 Marionette 构建一个专门与这个新设置配合使用的附加组件,以便提供我想要的功能。

\n
\n\n

在这里找到:http://derickbailey.com/2014/06/10/browserify-my-new-choice-for-modules-in-a-browser-backbone-app/

\n\n

该引用现在有点过时了(一年前),但考虑到该功能已被弃用,并且没有任何替代提案。

\n