BlockingEventHandlerOptions
BlockingEventHandlerOptions
Options for registering a blocking event handler.
Signature
type BlockingEventHandlerOptions<T extends VendureEvent> = {
event: Type<T> | Array<Type<T>>;
handler: (event: T) => void | Promise<void>;
id: string;
before?: string;
after?: string;
}
event
property
Type<T> | Array<Type<T>>
The event type to which the handler should listen. Can be a single event type or an array of event types.
handler
property
(event: T) => void | Promise<void>
The handler function which will be executed when the event is published. If the handler returns a Promise, the event publishing code will wait for the Promise to resolve before continuing. Any errors thrown by the handler will cause the event publishing code to fail.
id
property
string
A unique identifier for the handler. This can then be used to specify the order in which
handlers should be executed using the before
and after
options in other handlers.
before
property
string
The ID of another handler which this handler should execute before.
after
property
string
The ID of another handler which this handler should execute after.