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 the subscriber object must have an onabc member which is a function
  • Once 'abc' event is fired, then the onabc 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 data
    • sender: the entity that generated the event

2.2.1.4. Errors

In case of input errors, this exception is raised: 'Invalid subscriber type or missing required handler'

2.2.2. unregister

2.2.3. fire