I'm trying to extend marionette's module class in coffeescript, using a commonJS pattern, so that I can require a general Module class to reuse across parts of my app. So far, no luck.
So far I've tried this:
module.exports = class SingleFeed extends Marionette.Module
@addInitializer((options) =>
console.log 'initialize'
)
and this:
module.exports = Marionette.Module.extend(
@addInitializer((options) =>
console.log 'initialize'
)
)
With the hope that I could reuse this code in my application like this:
HomeFeed = require '../modules/components/feeds/SingleFeed'
hf = new HomeFeed()
app.module('HomeFeed',
moduleClass: hf
).start(options)
Has anyone successfully done this with coffeescript? Or does anyone have any ideas that might help?
Here's the documentation I'm referencing: https://github.com/marionettejs/backbone.marionette/blob/master/docs/marionette.application.module.md
@addInitializer
doesn't make sense. – Esteban