EventBusBase(baseEvent, …args) → {EventBusBase}

Abstract base class for all the event busses

new EventBusBase(baseEvent, …args) → {EventBusBase}

Creates a new event bus that can only send or receive a specific type of events

Parameters:
Name Type Attributes Description
baseEvent EventBase

A class that implements EventBase. The event bus will only allow this type of event.

args * <repeatable>

Arguments passed through to the EventEmitter base class.

Returns:
EventBusBase -

The EventBusBase object

Properties:
Name Type Description
allowedEvenets Set

A Set of events that are allowed on this bus

Extends

  • EventEmitter

Members

static eventBusList

Returns a Map of the event busses that have been created

Methods

checkEvent(event)

Checks if an event is of the correct type for this event bus

Parameters:
Name Type Description
event EventBase

The object to check to see if it is the right type

Throws:

TypeError on event that is wrong type

async emit(eventName, event, …argsopt) → {Promise.<boolean>}

Synchronously calls each of the listeners registered for the event named eventName, in the order they were registered, passing the supplied arguments to each. See also: {link https://nodejs.org/api/events.html#events_emitter_emit_eventname_args|EventEmitter.emit}

Parameters:
Name Type Attributes Description
eventName string

The name of the event

event EventBase

An event that inherits from EventBase and is type of event described by eventBase in EventBusBase.constructor

args * <optional>
<repeatable>

Any arguments

Returns:
Promise.<boolean> -

Returns a Promise that resolves to true if the event had listeners; false otherwise