HookRegistry
Defined in: src/hooks/registry.ts:38
Implementation of the hook registry for managing hook callbacks. Maintains mappings between event types and callback functions.
Implements
Section titled “Implements”HookRegistry
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new HookRegistry(): HookRegistryImplementation;Defined in: src/hooks/registry.ts:41
Returns
Section titled “Returns”HookRegistryImplementation
Methods
Section titled “Methods”addCallback()
Section titled “addCallback()”addCallback<T>( eventType, callback, options?): HookCleanup;Defined in: src/hooks/registry.ts:46
HookRegistry.addCallback
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T extends HookableEvent |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
eventType | HookableEventConstructor<T> |
callback | HookCallback<T> |
options? | HookCallbackOptions |
Returns
Section titled “Returns”HookCleanup
Implementation of
Section titled “Implementation of”HookRegistry.addCallbackinvokeCallbacks()
Section titled “invokeCallbacks()”invokeCallbacks<T>(event): Promise<T>;Defined in: src/hooks/registry.ts:86
Invoke all registered callbacks for the given event. Awaits each callback, supporting both sync and async.
InterruptErrors are collected across callbacks rather than immediately thrown, allowing all hooks to register their interrupts. Non-interrupt errors propagate immediately.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T extends HookableEvent |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
event | T | The event to invoke callbacks for |
Returns
Section titled “Returns”Promise<T>
The event after all callbacks have been invoked
Throws
Section titled “Throws”InterruptError with all collected interrupts after all callbacks complete