Events API

Events API is common to all objects implementing the Events. This includes Dataset and Sequencer.

event_callback(eArg, eInfo)

Callback function for event notification, invoked by event provider.

Arguments:
  • eArg (object) – Event argument. Application specific object defined by event provider. May be undefined. Typically used to describe the state transition that caused the event to be triggered.
  • eInfo (object) –

    Event information. Generic object defined by event provider.

    eInfo.src
    event provider object
    eInfo.name
    event name
    eInfo.sub
    subscription object
    eInfo.init
    true if event is init event
class EventProviderInterface()

Event provider interface

EventProviderInterface.on(name, callback[, options])

Register a callback for events with given name. Returns subscription handle.

Arguments:
  • name (string) – event name
  • callback (function) – event_callback()
  • options (object) –

    Callback options

    options.ctx
    Specify context for this object in event callback. If not specified, this is the event provider.
    options.init
    Boolean. If false, opt out of init event semantics.
Throws:

Error if event name is not defined.

Returns object:

subscription. Use subscription handle to cancel subscription with off().

EventProviderInterface.off(subscription)

Un-register a callback for given subscription handle.

Arguments:
  • subscription (object) – subscription handle from on()