EventBus

Type parameters

T: SuperConstructor

T: SuperConstructor

Hierarchy

Implements

Index

Constructors

Methods

Constructors

constructor

+ new EventBus(): EventBus

Overrides HandlingMixin.constructor

Creates an instance of CommandBus. Creates an instance of CommandBus.

Returns: EventBus

Methods

ensureHandleability

ensureHandleability(messageType: MessageTypeMessage›, handleableTypes?: MessageTypeMessage› | MessageTypeMessage›[]): boolean

Implementation of EventBus

Inherited from HandlingMixin.ensureHandleability

Overrides CancelingEmployment.ensureHandleability

Parameters:

NameType
messageTypeMessageTypeMessage
handleableTypes?MessageTypeMessage› | MessageTypeMessage›[]

Returns: boolean


getActions

getActions(): Actions

Implementation of Hookable

Inherited from HookableMixin.getActions

Overrides CreateEmployee.getActions

Returns: Actions


getHandleableTypes

getHandleableTypes(): MessageTypeMessage›[]

Implementation of EventBus

Inherited from HandlingMixin.getHandleableTypes

Overrides CancelingEmployment.getHandleableTypes

Returns: MessageTypeMessage›[]


getHandled

getHandled(messageType: MessageTypeMessage›): MessageTypeMessage›[]

Implementation of EventBus

Inherited from HandlingMixin.getHandled

Overrides CancelingEmployment.getHandled

Parameters:

NameType
messageTypeMessageTypeMessage

Returns: MessageTypeMessage›[]


getHandledCommands

getHandledCommands(): MessageTypeCommand›[]

Inherited from HandlingMixin.getHandledCommands

Overrides CancelingEmployment.getHandledCommands

Returns: MessageTypeCommand›[]


getHandledEvents

getHandledEvents(): MessageTypeEvent›[]

Inherited from HandlingMixin.getHandledEvents

Overrides CancelingEmployment.getHandledEvents

Returns: MessageTypeEvent›[]


getHandledMessages

getHandledMessages(): MessageTypeMessage›[]

Inherited from HandlingMixin.getHandledMessages

Overrides CancelingEmployment.getHandledMessages

Returns: MessageTypeMessage›[]


getHandledTypes

getHandledTypes(): MessageTypeMessage›[]

Implementation of EventBus

Inherited from HandlingMixin.getHandledTypes

Overrides CancelingEmployment.getHandledTypes

Returns: MessageTypeMessage›[]


getHandledTypesNames

getHandledTypesNames(): TypeName[]

Implementation of EventBus

Inherited from HandlingMixin.getHandledTypesNames

Overrides CancelingEmployment.getHandledTypesNames

Returns: TypeName[]


getHandler

getHandler(messageType: MessageTypeMessage›): Handler[] | undefined

Implementation of EventBus

Inherited from OneToManyHandlingMixin.getHandler

Overrides void

Parameters:

NameType
messageTypeMessageTypeMessage

Returns: Handler[] | undefined


getHandlerOrThrow

getHandlerOrThrow(messageType: MessageTypeMessage›): Handler[]

Implementation of EventBus

Inherited from OneToManyHandlingMixin.getHandlerOrThrow

Overrides void

Parameters:

NameType
messageTypeMessageTypeMessage

Returns: Handler[]


getHandlers

getHandlers(): Map‹MessageTypeMessage›, Handler | Handler[]›

Implementation of EventBus

Inherited from HandlingMixin.getHandlers

Overrides CancelingEmployment.getHandlers

Returns: Map‹MessageTypeMessage›, Handler | Handler[]›


getHook

getHook(action: string, id: string): Hook | undefined

Implementation of Hookable

Inherited from HookableMixin.getHook

Overrides CreateEmployee.getHook

Parameters:

NameType
actionstring
idstring

Returns: Hook | undefined


getHookOrThrow

getHookOrThrow(action: string, id: string): Hook

Implementation of Hookable

Inherited from HookableMixin.getHookOrThrow

Overrides CreateEmployee.getHookOrThrow

Parameters:

NameType
actionstring
idstring

Returns: Hook


getHooks

getHooks(action: string): Mappings

Implementation of Hookable

Inherited from HookableMixin.getHooks

Overrides CreateEmployee.getHooks

Parameters:

NameType
actionstring

Returns: Mappings


getTypeByHandler

getTypeByHandler(handlerReference: Handler): any | undefined

Inherited from OneToManyHandlingMixin.getTypeByHandler

Overrides void

Parameters:

NameType
handlerReferenceHandler

Returns: any | undefined


handle

handle(event: Event): Promise‹void›

Overrides OneToManyHandlingMixin.handle

Handles event instance concurrently.

async

Parameters:

NameTypeDescription
eventEventAn instance of Event type.

Returns: Promise‹void›


handles

handles(): Map‹MessageTypeCommand›, Handler

Implementation of EventBus

Inherited from HandlingMixin.handles

Overrides CancelingEmployment.handles

Returns: Map‹MessageTypeCommand›, Handler


hasAction

hasAction(action: string): boolean

Implementation of Hookable

Inherited from HookableMixin.hasAction

Overrides CreateEmployee.hasAction

Parameters:

NameType
actionstring

Returns: boolean


hasHandler

hasHandler(messageType: MessageTypeMessage›): boolean

Implementation of EventBus

Inherited from HandlingMixin.hasHandler

Overrides CancelingEmployment.hasHandler

Parameters:

NameType
messageTypeMessageTypeMessage

Returns: boolean


hasHook

hasHook(action: string, id: string): boolean

Implementation of Hookable

Inherited from HookableMixin.hasHook

Overrides CreateEmployee.hasHook

Parameters:

NameType
actionstring
idstring

Returns: boolean


initialize

initialize(): void

Implementation of EventBus

Inherited from OneToManyHandlingMixin.initialize

Overrides void

Returns: void


isHandleabe

isHandleabe(messageType: MessageTypeMessage›, handleableTypes?: MessageTypeMessage› | MessageTypeMessage›[]): boolean

Inherited from HandlingMixin.isHandleabe

Overrides CancelingEmployment.isHandleabe

Parameters:

NameType
messageTypeMessageTypeMessage
handleableTypes?MessageTypeMessage› | MessageTypeMessage›[]

Returns: boolean


onPublish

onPublish(id: string, hook: Hook, shouldOverride?: boolean): void

Implementation of EventBus

Registers onPublish callback hook.

Parameters:

NameTypeDescription
idstringIdentifier under which onPublish hook will be defined.
hookHookFunction that will be executed upon publishing Event.
shouldOverride?booleanFlag indicating that hook should be overridden if exist.

Returns: void


overrideHandler

overrideHandler(messageType: MessageTypeMessage›, handler: Handler): void

Implementation of EventBus

Inherited from HandlingMixin.overrideHandler

Overrides CancelingEmployment.overrideHandler

Parameters:

NameType
messageTypeMessageTypeMessage
handlerHandler

Returns: void


overrideHook

overrideHook(action: string, id: string, hook: Hook): void

Implementation of Hookable

Inherited from HookableMixin.overrideHook

Overrides CreateEmployee.overrideHook

Parameters:

NameType
actionstring
idstring
hookHook

Returns: void


publish

publish(event: Event): Promise‹void›

Implementation of EventBus

alias handle

async

Parameters:

NameType
eventEvent

Returns: Promise‹void›


registerHandler

registerHandler(eventType: MessageTypeEvent›, handler: Handler, shouldOverride?: boolean): void

Implementation of EventBus

Overrides OneToManyHandlingMixin.registerHandler

Registers handler for event.

throws {UnhandleableTypeError} Thrown if the type argument is not subclass of Event type.

throws {InvalidHandlerError} Thrown if the handler argument is not a function.

Parameters:

NameTypeDescription
eventTypeMessageTypeEventA subclass of Event type.
handlerHandlerHandler function that will executed upon handling type.
shouldOverride?booleanFlag indicating that handler should be overridden if exist.

Returns: void


registerHook

registerHook(action: string, id: string, hook: Hook, shouldOverride?: boolean): void

Implementation of Hookable

Inherited from HookableMixin.registerHook

Overrides CreateEmployee.registerHook

Parameters:

NameType
actionstring
idstring
hookHook
shouldOverride?boolean

Returns: void


removeHandler

removeHandler(messageType: MessageTypeMessage›): void

Implementation of EventBus

Inherited from HandlingMixin.removeHandler

Overrides CancelingEmployment.removeHandler

Parameters:

NameType
messageTypeMessageTypeMessage

Returns: void


removeHook

removeHook(action: string, id: string): void

Implementation of Hookable

Inherited from HookableMixin.removeHook

Overrides CreateEmployee.removeHook

Parameters:

NameType
actionstring
idstring

Returns: void


setHandleableTypes

setHandleableTypes(handleableTypes: MessageTypeMessage› | MessageTypeMessage›[]): void

Implementation of EventBus

Inherited from HandlingMixin.setHandleableTypes

Overrides CancelingEmployment.setHandleableTypes

Parameters:

NameType
handleableTypesMessageTypeMessage› | MessageTypeMessage›[]

Returns: void


subscribeTo

subscribeTo(eventType: MessageTypeEvent›, handler: Handler): void

Subscribes to event with handler.

alias registerHandler

Parameters:

NameType
eventTypeMessageTypeEvent
handlerHandler

Returns: void


subscribes

subscribes(): Map‹MessageTypeEvent›, Handler

Implementation of EventBus

Inherited from HandlingMixin.subscribes

Overrides CancelingEmployment.subscribes

Returns: Map‹MessageTypeEvent›, Handler