EventBus
Type parameters
▪ T: SuperConstructor
▪ T: SuperConstructor
Hierarchy
SuperPrototypeSelector‹HookableMixin | OneToManyHandlingMixin, this› & HookableMixin‹this› & OneToManyHandlingMixin‹this›
SuperPrototypeSelector‹HookableMixin | OneToManyHandlingMixin, this› & HookableMixin‹this› & OneToManyHandlingMixin‹this›
↳ EventBus
Implements
- Hookable
- Controller
- EventBus
- Hookable
- Controller
- EventBus
Index
Constructors
Methods
- ensureHandleability
- getActions
- getHandleableTypes
- getHandled
- getHandledCommands
- getHandledEvents
- getHandledMessages
- getHandledTypes
- getHandledTypesNames
- getHandler
- getHandlerOrThrow
- getHandlers
- getHook
- getHookOrThrow
- getHooks
- getTypeByHandler
- handle
- handles
- hasAction
- hasHandler
- hasHook
- initialize
- isHandleabe
- onPublish
- overrideHandler
- overrideHook
- publish
- registerHandler
- registerHook
- removeHandler
- removeHook
- setHandleableTypes
- subscribeTo
- subscribes
Constructors
constructor
+ new EventBus(): EventBus
Overrides HandlingMixin.constructor
Creates an instance of CommandBus. Creates an instance of CommandBus.
Returns: EventBus
Methods
ensureHandleability
▸ ensureHandleability(messageType
: MessageType‹Message›, handleableTypes?
: MessageType‹Message› | MessageType‹Message›[]): boolean
Implementation of EventBus
Inherited from HandlingMixin.ensureHandleability
Overrides CancelingEmployment.ensureHandleability
Parameters:
Name | Type |
---|---|
messageType | MessageType‹Message› |
handleableTypes? | MessageType‹Message› | MessageType‹Message›[] |
Returns: boolean
getActions
▸ getActions(): Actions
Implementation of Hookable
Inherited from HookableMixin.getActions
Overrides CreateEmployee.getActions
Returns: Actions
getHandleableTypes
▸ getHandleableTypes(): MessageType‹Message›[]
Implementation of EventBus
Inherited from HandlingMixin.getHandleableTypes
Overrides CancelingEmployment.getHandleableTypes
Returns: MessageType‹Message›[]
getHandled
▸ getHandled(messageType
: MessageType‹Message›): MessageType‹Message›[]
Implementation of EventBus
Inherited from HandlingMixin.getHandled
Overrides CancelingEmployment.getHandled
Parameters:
Name | Type |
---|---|
messageType | MessageType‹Message› |
Returns: MessageType‹Message›[]
getHandledCommands
▸ getHandledCommands(): MessageType‹Command›[]
Inherited from HandlingMixin.getHandledCommands
Overrides CancelingEmployment.getHandledCommands
Returns: MessageType‹Command›[]
getHandledEvents
▸ getHandledEvents(): MessageType‹Event›[]
Inherited from HandlingMixin.getHandledEvents
Overrides CancelingEmployment.getHandledEvents
Returns: MessageType‹Event›[]
getHandledMessages
▸ getHandledMessages(): MessageType‹Message›[]
Inherited from HandlingMixin.getHandledMessages
Overrides CancelingEmployment.getHandledMessages
Returns: MessageType‹Message›[]
getHandledTypes
▸ getHandledTypes(): MessageType‹Message›[]
Implementation of EventBus
Inherited from HandlingMixin.getHandledTypes
Overrides CancelingEmployment.getHandledTypes
Returns: MessageType‹Message›[]
getHandledTypesNames
▸ getHandledTypesNames(): TypeName[]
Implementation of EventBus
Inherited from HandlingMixin.getHandledTypesNames
Overrides CancelingEmployment.getHandledTypesNames
Returns: TypeName[]
getHandler
▸ getHandler(messageType
: MessageType‹Message›): Handler[] | undefined
Implementation of EventBus
Inherited from OneToManyHandlingMixin.getHandler
Overrides void
Parameters:
Name | Type |
---|---|
messageType | MessageType‹Message› |
Returns: Handler[] | undefined
getHandlerOrThrow
▸ getHandlerOrThrow(messageType
: MessageType‹Message›): Handler[]
Implementation of EventBus
Inherited from OneToManyHandlingMixin.getHandlerOrThrow
Overrides void
Parameters:
Name | Type |
---|---|
messageType | MessageType‹Message› |
Returns: Handler[]
getHandlers
▸ getHandlers(): Map‹MessageType‹Message›, Handler | Handler[]›
Implementation of EventBus
Inherited from HandlingMixin.getHandlers
Overrides CancelingEmployment.getHandlers
Returns: Map‹MessageType‹Message›, Handler | Handler[]›
getHook
▸ getHook(action
: string, id
: string): Hook | undefined
Implementation of Hookable
Inherited from HookableMixin.getHook
Overrides CreateEmployee.getHook
Parameters:
Name | Type |
---|---|
action | string |
id | string |
Returns: Hook | undefined
getHookOrThrow
▸ getHookOrThrow(action
: string, id
: string): Hook
Implementation of Hookable
Inherited from HookableMixin.getHookOrThrow
Overrides CreateEmployee.getHookOrThrow
Parameters:
Name | Type |
---|---|
action | string |
id | string |
Returns: Hook
getHooks
▸ getHooks(action
: string): Mappings
Implementation of Hookable
Inherited from HookableMixin.getHooks
Overrides CreateEmployee.getHooks
Parameters:
Name | Type |
---|---|
action | string |
Returns: Mappings
getTypeByHandler
▸ getTypeByHandler(handlerReference
: Handler): any | undefined
Inherited from OneToManyHandlingMixin.getTypeByHandler
Overrides void
Parameters:
Name | Type |
---|---|
handlerReference | Handler |
Returns: any | undefined
handle
▸ handle(event
: Event): Promise‹void›
Overrides OneToManyHandlingMixin.handle
Handles event instance concurrently.
async
Parameters:
Name | Type | Description |
---|---|---|
event | Event | An instance of Event type. |
Returns: Promise‹void›
handles
▸ handles(): Map‹MessageType‹Command›, Handler›
Implementation of EventBus
Inherited from HandlingMixin.handles
Overrides CancelingEmployment.handles
Returns: Map‹MessageType‹Command›, Handler›
hasAction
▸ hasAction(action
: string): boolean
Implementation of Hookable
Inherited from HookableMixin.hasAction
Overrides CreateEmployee.hasAction
Parameters:
Name | Type |
---|---|
action | string |
Returns: boolean
hasHandler
▸ hasHandler(messageType
: MessageType‹Message›): boolean
Implementation of EventBus
Inherited from HandlingMixin.hasHandler
Overrides CancelingEmployment.hasHandler
Parameters:
Name | Type |
---|---|
messageType | MessageType‹Message› |
Returns: boolean
hasHook
▸ hasHook(action
: string, id
: string): boolean
Implementation of Hookable
Inherited from HookableMixin.hasHook
Overrides CreateEmployee.hasHook
Parameters:
Name | Type |
---|---|
action | string |
id | string |
Returns: boolean
initialize
▸ initialize(): void
Implementation of EventBus
Inherited from OneToManyHandlingMixin.initialize
Overrides void
Returns: void
isHandleabe
▸ isHandleabe(messageType
: MessageType‹Message›, handleableTypes?
: MessageType‹Message› | MessageType‹Message›[]): boolean
Inherited from HandlingMixin.isHandleabe
Overrides CancelingEmployment.isHandleabe
Parameters:
Name | Type |
---|---|
messageType | MessageType‹Message› |
handleableTypes? | MessageType‹Message› | MessageType‹Message›[] |
Returns: boolean
onPublish
▸ onPublish(id
: string, hook
: Hook, shouldOverride?
: boolean): void
Implementation of EventBus
Registers onPublish
callback hook.
Parameters:
Name | Type | Description |
---|---|---|
id | string | Identifier under which onPublish hook will be defined. |
hook | Hook | Function that will be executed upon publishing Event . |
shouldOverride? | boolean | Flag indicating that hook should be overridden if exist. |
Returns: void
overrideHandler
▸ overrideHandler(messageType
: MessageType‹Message›, handler
: Handler): void
Implementation of EventBus
Inherited from HandlingMixin.overrideHandler
Overrides CancelingEmployment.overrideHandler
Parameters:
Name | Type |
---|---|
messageType | MessageType‹Message› |
handler | Handler |
Returns: void
overrideHook
▸ overrideHook(action
: string, id
: string, hook
: Hook): void
Implementation of Hookable
Inherited from HookableMixin.overrideHook
Overrides CreateEmployee.overrideHook
Parameters:
Name | Type |
---|---|
action | string |
id | string |
hook | Hook |
Returns: void
publish
▸ publish(event
: Event): Promise‹void›
Implementation of EventBus
alias
handle
async
Parameters:
Name | Type |
---|---|
event | Event |
Returns: Promise‹void›
registerHandler
▸ registerHandler(eventType
: MessageType‹Event›, 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:
Name | Type | Description |
---|---|---|
eventType | MessageType‹Event› | A subclass of Event type. |
handler | Handler | Handler function that will executed upon handling type. |
shouldOverride? | boolean | Flag 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:
Name | Type |
---|---|
action | string |
id | string |
hook | Hook |
shouldOverride? | boolean |
Returns: void
removeHandler
▸ removeHandler(messageType
: MessageType‹Message›): void
Implementation of EventBus
Inherited from HandlingMixin.removeHandler
Overrides CancelingEmployment.removeHandler
Parameters:
Name | Type |
---|---|
messageType | MessageType‹Message› |
Returns: void
removeHook
▸ removeHook(action
: string, id
: string): void
Implementation of Hookable
Inherited from HookableMixin.removeHook
Overrides CreateEmployee.removeHook
Parameters:
Name | Type |
---|---|
action | string |
id | string |
Returns: void
setHandleableTypes
▸ setHandleableTypes(handleableTypes
: MessageType‹Message› | MessageType‹Message›[]): void
Implementation of EventBus
Inherited from HandlingMixin.setHandleableTypes
Overrides CancelingEmployment.setHandleableTypes
Parameters:
Name | Type |
---|---|
handleableTypes | MessageType‹Message› | MessageType‹Message›[] |
Returns: void
subscribeTo
▸ subscribeTo(eventType
: MessageType‹Event›, handler
: Handler): void
Subscribes to event with handler.
alias
registerHandler
Parameters:
Name | Type |
---|---|
eventType | MessageType‹Event› |
handler | Handler |
Returns: void
subscribes
▸ subscribes(): Map‹MessageType‹Event›, Handler›
Implementation of EventBus
Inherited from HandlingMixin.subscribes
Overrides CancelingEmployment.subscribes
Returns: Map‹MessageType‹Event›, Handler›