Class: ComponentDispatcher<IncomingEventType, OutgoingResponseType>
Class: ComponentDispatcher<IncomingEventType, OutgoingResponseType>
ComponentDispatcher
A component dispatcher for dispatching component-based event handlers.
Type Parameters
IncomingEventType
IncomingEventType
extends IIncomingEvent
OutgoingResponseType
OutgoingResponseType
= unknown
Implements
IDispacher
<IncomingEventType
,OutgoingResponseType
>
Constructors
Constructor
new ComponentDispatcher<IncomingEventType, OutgoingResponseType>(resolver): ComponentDispatcher<IncomingEventType, OutgoingResponseType>;
Create a new instance of ClassDispatcher
Parameters
resolver
The dependency resolver
Returns
ComponentDispatcher
<IncomingEventType
, OutgoingResponseType
>
Methods
dispatch()
dispatch(context): Promiseable<OutgoingResponseType>;
For the component we don't resolve the handler here. So Component third party library can handle all the logic.
Parameters
context
DispatcherContext
<IncomingEventType
, OutgoingResponseType
>
The dispatcher context
Returns
Promiseable
<OutgoingResponseType
>
The outgoing response
Throws
If the action is not found in the handler
Implementation of
getName()
getName(route): Promise<string>;
Get the name of the handler
Parameters
route
Route
<IncomingEventType
, OutgoingResponseType
>
The route
Returns
Promise
<string
>
The name of the handler