Problem and motivation:
Currently, an application starts when created. That forces the developer to create wrappers to delay the initialization. Also, there is no way to "destroy" an application (force unsubscribe all listeners and let the GC do its work). Finally, "dependencies" mechanism looks utterly useless.
Solution:
- Remove
dependencies field from createApp config.
- Introduce two methods to the application:
init and destroy.
init method should initialize modules with provided dependencies, start an engine and dispatch a special init event.
- Application state still should be subscribable at any time.
destroy method should unsubscribe all store subscriptions and dispatch a special destroy event.
Problem and motivation:
Currently, an application starts when created. That forces the developer to create wrappers to delay the initialization. Also, there is no way to "destroy" an application (force unsubscribe all listeners and let the GC do its work). Finally, "dependencies" mechanism looks utterly useless.
Solution:
dependenciesfield fromcreateAppconfig.initanddestroy.initmethod should initialize modules with provided dependencies, start an engine and dispatch a specialinitevent.destroymethod should unsubscribe all store subscriptions and dispatch a specialdestroyevent.