Class: CallableDispatcher<IncomingEventType, OutgoingResponseType>
Class: CallableDispatcher<IncomingEventType, OutgoingResponseType>
CallableDispatcher
A callable dispatcher for dispatching function-based event handlers.
Type Parameters
IncomingEventType
IncomingEventType
extends IIncomingEvent
OutgoingResponseType
OutgoingResponseType
= unknown
Implements
IDispacher
<IncomingEventType
,OutgoingResponseType
>
Constructors
Constructor
new CallableDispatcher<IncomingEventType, OutgoingResponseType>(resolver): CallableDispatcher<IncomingEventType, OutgoingResponseType>;
Create a new instance of CallableDispatcher
Parameters
resolver
The dependency resolver
Returns
CallableDispatcher
<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