-
Notifications
You must be signed in to change notification settings - Fork 292
Core Events
Due to the modular approach we've taken for the architecture of the client application, we make heavy use of the observer code design pattern, and use events to keep the various parts of the application updated.
Additionally, our chosen framework for structuring the client application (Backbone.js) has very good support for an event-driven approach.
Backbone supports a wide variety of different events which we make use of extensively throughout the application. Please see the Backbone.js documentation for more information:
In addition to the Backbone events, we've added many events which we use throughout the application, and can be listened to by any plugin code.
You can listen to system events using the following syntax: Origin.on(FUNCTION, CALLBACK_FUNCTION)
For example:
Origin.on('origin:initialize', function() {
console.log('App is ready to go');
});
See below for a list of core events, and what they signal.
Event name | What it signals | Parameters passed to callback |
---|---|---|
origin:dataReady |
The app's data has been loaded, and is about to initialise | |
origin:initialize |
the app has initialised | |
origin:showLoading |
||
origin:hideLoading |
||
origin:sessionStarted |
||
remove:views |
We've also included some of the Window object's events for ease of use:
Event name | What it signals | Parameters passed to callback |
---|---|---|
key:down |
||
window:resize |
||
window:focus |
||
window:blur |
Event name | What it signals | Parameters passed to callback |
---|---|---|
constants:loaded |
||
l10n:loaded |
||
location:change |
||
router:MODULE:LOCATION1:LOCATION2:LOCATION3:LOCATION4 |
||
contentCollection:dataLoaded |
||
VIEW:preRender |
||
VIEW:postRender |