Class: ClassDispatcher<IncomingEventType, OutgoingResponseType>
Class: ClassDispatcher<IncomingEventType, OutgoingResponseType>
ClassDispatcher
A class dispatcher for dispatching class-based event handlers.
Type Parameters
IncomingEventType
IncomingEventType
extends IIncomingEvent
OutgoingResponseType
OutgoingResponseType
= unknown
Implements
IDispacher
<IncomingEventType
,OutgoingResponseType
>
Constructors
Constructor
new ClassDispatcher<IncomingEventType, OutgoingResponseType>(resolver): ClassDispatcher<IncomingEventType, OutgoingResponseType>;
Create a new instance of ClassDispatcher
Parameters
resolver
The dependency resolver
Returns
ClassDispatcher
<IncomingEventType
, OutgoingResponseType
>
Methods
dispatch()
dispatch(context): Promise<OutgoingResponseType>;
Dispatch the event to the handler
Parameters
context
DispatcherContext
<IncomingEventType
, OutgoingResponseType
>
The dispatcher context
Returns
Promise
<OutgoingResponseType
>
The outgoing response
Throws
If the action is not found in the handler
Implementation of
getName()
getName(route): string;
Get the name of the handler
Parameters
route
Route
<IncomingEventType
, OutgoingResponseType
>
The route
Returns
string
The name of the handler