trigger #
Triggers a custom event.
This allows interactions with others plugins using hooks or pipes.
If the event is listened by pipes, the result of the pipe chain will be returned in a promise. If there is no listener, the result will be the same payload. This behavior can be used for a Remote Procedure Call (RPC) system between plugins.
Arguments #
trigger(eventName: string, ...any): Promise<any>;
Arguments | Type | Description |
---|---|---|
event | string | Custom event name |
payload | object | Event payload |
Note: the triggered event is renamed by the following format:plugin-<plugin name>:<event>
.
Returns #
Returns a promise resolving to the pipe chain result.
Usage #
await context.accessors.trigger('eventSayHello', 'World');
Edit this page on Github(opens new window)