I what to share some events from my application to be shared across the views and controllers.
For example, event: “updates from server are available”.
To do that I can fireEvent(“updatesAvailable”) in the controller, but that makes other components to subscribe to that particular controller that fires that event.
What I want is to have a singleton object that will keep all application logic events subscriptions.
Currently I see that I can solve the problem with having one shared view instance and subscribe all to it. But I would like to know is there is one out of the box Event Dispatcher that is aware about all events inside the application.
As far as I understand you want to use pattern ‘Event Bus’?
You could use the ‘global’ and single object that exists in every ST2 application – Ext.Viewport. At least I’m creating in my app and till now nothing is bad.
Note, the best place to create event handler is controller’s init() method.
in the another controller (or ever view) you could write