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.
Implements
Section titled “Implements”HookRegistry
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new HookRegistry(): HookRegistryImplementation;Defined in: src/hooks/registry.ts:49
Returns
Section titled “Returns”HookRegistryImplementation
Methods
Section titled “Methods”addCallback()
Section titled “addCallback()”addCallback<T>(eventType, callback): HookCleanup;Defined in: src/hooks/registry.ts:61
Register a callback function for a specific event type.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T extends HookEvent |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
eventType | HookEventConstructor<T> | The event class constructor to register the callback for |
callback | HookCallback<T> | The callback function to invoke when the event occurs |
Returns
Section titled “Returns”HookCleanup
Cleanup function that removes the callback when invoked
Implementation of
Section titled “Implementation of”HookRegistry.addCallbackaddHook()
Section titled “addHook()”addHook(provider): void;Defined in: src/hooks/registry.ts:82
Register all callbacks from a hook provider.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
provider | HookProvider | The hook provider to register |
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”HookRegistry.addHookaddAllHooks()
Section titled “addAllHooks()”addAllHooks(providers): void;Defined in: src/hooks/registry.ts:101
Register all callbacks from multiple hook providers.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
providers | HookProvider[] | Array of hook providers to register |
Returns
Section titled “Returns”void
removeHook()
Section titled “removeHook()”removeHook(provider): void;Defined in: src/hooks/registry.ts:112
Remove all callbacks registered by a hook provider.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
provider | HookProvider | The hook provider to remove |
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”HookRegistry.removeHookinvokeCallbacks()
Section titled “invokeCallbacks()”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 Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T extends HookEvent |
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