Application Event Handling - write-software/enginejs GitHub Wiki
Application Events
With WebApp you can register event triggers. This allows you to register one or more functions to be call upon and event.
Example: someone signing in.
app.events.register("onsignin",function()
{
alert("Event onsignin 1");
})
app.events.register("onsignin",function()
{
alert("Event onsignin 2");
})
The in your method that handles the signing in you can call
app.events.fire("onsignin")
This means that at any point in the application where there has been a registration on the "onsignin", those functions will be called. This can be especially useful when you need two different parts of the application to react to an event but may be in different ways, while still maintaining a modular approach.