Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Event

Concrete implementation of IEvent interface. It allows to send asynchronous notifications to multiple subscribed listeners.

see

IEvent

see

IEventListener

Example

let event = new Event("my_event");

event.addListener(myListener);

event.notify("123", Parameters.fromTuples(
  "param1", "ABC",
  "param2", 123
));

Hierarchy

  • Event

Implements

Index

Constructors

constructor

  • new Event(name: string): Event
  • Creates a new event and assigns its name.

    throws

    an Error if the name is null.

    Parameters

    • name: string

      the name of the event that is to be created.

    Returns Event

Methods

addListener

  • Adds a listener to receive notifications when this event is fired.

    Parameters

    Returns void

getListeners

  • Gets all listeners registred in this event.

    Returns IEventListener[]

    a list of listeners.

getName

  • getName(): string
  • Gets the name of the event.

    Returns string

    the name of this event.

notify

  • notify(correlationId: string, args: Parameters): void
  • Fires this event and notifies all registred listeners.

    throws

    an InvocationException if the event fails to be raised.

    Parameters

    • correlationId: string

      (optional) transaction id to trace execution through call chain.

    • args: Parameters

      the parameters to raise this event with.

    Returns void

removeListener

  • Removes a listener, so that it no longer receives notifications for this event.

    Parameters

    Returns void

Generated using TypeDoc