Call all hooks for a given event.
The event to call the hooks for.
Rest
...args: THooks[TEventName] extends ((...args: any) => any)The arguments to pass to the hooks.
Rest
...args: TEventName extends keyof THooksUn-register a hook for a given lifecycle event.
The event to un-register the hook for.
The function to un-register.
Whether a hook was un-registered.
Register a new hook for a given lifecycle event that will only be called once, then un-registered.
The event to register the hook for.
The function to call when the event is triggered.
A class for registering, un-registering, and calling hooks. The events that can be hooked into are defined in the
Hooks
type, but any string can be used as an event name, allowing plugins to define their own hooks.Remarks
Each registered hook is awaited in series to ensure that hooks are called in the order they were registered.