-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
App Life Cycle #2200
Comments
I'm not sure if this is a good idea, but that is a separate discussion. Assuming that it is a good idea, then the way this issue has been presented is correct per se.
Something does not exist until the Separate from that certain objects have lifecycle events while they are existing. These are This is likely due to the history of these two objects. Historically, there would be one Application that would never be destroyed – only started. Modules would be created that could be started and stopped. Going forward, if we wanted to introduce sub-applications, then adding To current users of Marionette, this change isn't as drastic as it might seem. If you strip the "namespace" functionality out of Modules; i.e.; the bit that lets you define them as:
tl;dr Apps may need |
I chose you have to call start to start an app. I can see I tend to remember the hell of |
I think apps/subapps need both Otherwise I don't see much point in separating the two, just always use |
Start seems nice bc initialize is different from start. |
If we are naming it destroy then this implies it cannot be restarted, Are I'm not against this I think it's a good idea to be explicit. However we do On Tuesday, 10 March 2015, Sam Saccone notifications@github.com wrote:
|
I'm with @jmeas here. Start and stop should be paired, as should init/destroy. Don't have one without the other, for consistency if nothing else. Adding both would be a nice transition for those using modules as subapps as well. |
warning shameless plug ahead I've spent a lot of time lately in our own app with our app life-cycles and pulling out the patterns to create Marionette.Toolkit. We initially were trying to get away from our dependence on modules, while cleaning up our organization. The pattern that seemed to consistently affected our decision I think we took from @brian-mann early on. startSubApp: function(appName, args) {
var currentApp = this.module(appName);
if (this.currentApp === currentApp) {
return;
}
if (this.currentApp) {
this.currentApp.stop();
}
this.currentApp = currentApp;
currentApp.start(args);
}, This kind of state routing type logic would be far more complex if it had to check if the app was destroyed and then re-init it or something. Really you want to be able to init an app that either has its We found the issue around We found 3 major concern involving an app type object
I also know there are some concerns about an app-type object existing at all, relying on simpler objects and a smarter router. While I think this is certainly a reasonable pattern, I don't know that it is everything for everyone. I am 👍 on an app object, but I am very biased. |
Nice toolkit docs @paulfalgout! I think you've got the right idea. Would like to get some of this into Mn proper |
🎉 🐎 |
@marionettejs/marionette-core I'd be ok with closing this. While I will continue to use an app lifecycle pattern, I think it is overly opinionated and not needed in Marionette. |
Got another thumb.. so re-open or comment if you want to discuss this further. |
Can someone provide an information about lifecycle methods marionette vs react? |
Application objects should have a "start" and "destroy" method to introduce a formal life cycle to Applications.
The call order would look like this
constructor
initialize
beforeStart
start
beforeDestroy
destroy
@marionettejs/marionette-core thoughts?
The text was updated successfully, but these errors were encountered: