Like my title says, I do see that Marionette Module is now deprecated and we should AMD modules instead using requirejs. That is fine and everything but the modules had a great purpose in handling initializers and the before:start and start events. It allowed me to setup my regions, views, and collections with ease. What is the alternative now for handling this?
Below is an example of code 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);
});
});
});
var HomePageModule = new Marionette.Application({}); module.exports = HomePageModule;
? I haven't really looked into the implications of this, but this seems to achieve some of what you want but maybe with more extra sauce than you really need. – Mormon