Reputation: 751
I have a Backbone Marionette application that is structured using Modules. I have a situation where I want to reinitialize a module but when I try to do this nothing happens. Here's the situation:-
The first time the module is used the initialization handlers fire as they should. The module can then be stopped at some point in the future when the user goes elsewhere in the app. I want the module to then be reused if necessary and I want the initializers to fire at this point. I assumed that firing the module's start command would run through the initialization handlers again but when I do it, nothing happens.
Any ideas how I can restart a Marionette module in this way? I was trying to avoid setting up some kind of custom init command that would need firing manually.....
Thanks,
Sam
Upvotes: 0
Views: 1634
Reputation: 72858
You need to stop the module first. Call .stop()
and the module's finalizers will be run, putting the module in to a state where it can be started again. Once you have called stop()
, you will be able to call .start()
again.
Upvotes: 2