Skip to content

HookRegistry

Defined in: src/hooks/registry.ts:45

Implementation of the hook registry for managing hook callbacks. Maintains mappings between event types and callback functions.

  • HookRegistry
new HookRegistry(): HookRegistryImplementation;

Defined in: src/hooks/registry.ts:49

HookRegistryImplementation

addCallback<T>(eventType, callback): HookCleanup;

Defined in: src/hooks/registry.ts:61

Register a callback function for a specific event type.

Type Parameter
T extends HookEvent
ParameterTypeDescription
eventTypeHookEventConstructor<T>The event class constructor to register the callback for
callbackHookCallback<T>The callback function to invoke when the event occurs

HookCleanup

Cleanup function that removes the callback when invoked

HookRegistry.addCallback

addHook(provider): void;

Defined in: src/hooks/registry.ts:82

Register all callbacks from a hook provider.

ParameterTypeDescription
providerHookProviderThe hook provider to register

void

HookRegistry.addHook

addAllHooks(providers): void;

Defined in: src/hooks/registry.ts:101

Register all callbacks from multiple hook providers.

ParameterTypeDescription
providersHookProvider[]Array of hook providers to register

void


removeHook(provider): void;

Defined in: src/hooks/registry.ts:112

Remove all callbacks registered by a hook provider.

ParameterTypeDescription
providerHookProviderThe hook provider to remove

void

HookRegistry.removeHook

invokeCallbacks<T>(event): Promise<T>;

Defined in: src/hooks/registry.ts:130

Invoke all registered callbacks for the given event. Awaits each callback, supporting both sync and async.

Type Parameter
T extends HookEvent
ParameterTypeDescription
eventTThe event to invoke callbacks for

Promise<T>

The event after all callbacks have been invoked