Like my headline, I see that the Marionette module is now deprecated, and we should use AMD modules instead of requirejs. This is great, and everything except the modules has a big goal in handling initializers and events: start and start. This allowed me to easily customize my regions, views, and collections. What is the alternative for this?
Below is an example of the code that I would use:
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);
});
});
});
source
share