2. Working with Events¶
2.1. Events¶
Finre uses following application events.
2.2. EventManager¶
You can use finre.EventManager
to work with finre events.
2.2.1. register¶
2.2.1.1. Synopsis¶
finre.EventManager.register(type, subscriber)
2.2.1.2. Example¶
var subscriber = {
onabc: function(data, sender) {
// do something
}
}
finre.EventManager.register('abc', subscriber)
2.2.1.3. Description¶
- The
subscriber
argument must be an object - If
type
is'abc'
, then thesubscriber
object must have anonabc
member which is a function - Once
'abc'
event is fired, then theonabc
member of the subscriber would be invoked by finre to handle the event - The
onabc
function would receive these two arguments when callled by finre: data
: event datasender
: the entity that generated the event
- The
2.2.1.4. Errors¶
In case of input errors, this exception is raised: 'Invalid subscriber type or missing required handler'