IEventListener

An interface for listener objects that receive notifications on fired events.

Description

The IEventListener interface allows you to define actions to be taken by listener objects after receiving a notification on a fired event.

Instance methods

onEvent

A method called when events this listener is subscribed to are fired.

void onEvent(String? correlationId, IEvent event, Parameters args)

  • correlationId: String? - fired evemt
  • event: IEvent - (optional) transaction id used to trace execution through the call chain.
  • args: Parameters - event arguments.

Examples

class MyListener implements IEventListener {
     void _onEvent(String? correlationId, IEvent event, Parameters args ) {
        print('Fired event ' + event.getName());
    }
}

var event =  Event('myevent');
event.addListener( MyListener());
event.notify('123', Parameters.fromTuples(['param1', 'ABC']));

// Console output: Fired event myevent

See also