Class HookHandler<HookConfig>Private
Properties
Private
Readonly
#eventTarget
#eventTarget: object
Private
Readonly
#listeners
Private
Readonly
#onRunHook
Private
Readonly
#validHookNames
Methods
Private
#assertValidHookName
- #assertValidHookName(hookName): void
Returns void
Private
#getNamedListener
addListener
- addListener<HookName>(hookName, listener, listenerName?): (() => void)
Type Parameters
- HookName extends string | number | symbol
Returns (() => void)
addListeners
- addListeners(listeners): void
Returns void
getListenerCount
- getListenerCount(hookName): number
Returns number
hasListeners
- hasListeners(hookName): boolean
Returns boolean
removeAllListeners
- removeAllListeners(): void
Returns void
removeListener
- removeListener<HookName>(hookName, listenerOrListenerName): void
Type Parameters
- HookName extends string | number | symbol
Returns void
runAsync
- runAsync<HookName>(hookName, ...args): Promise<void>
Type Parameters
- HookName extends string | number | symbol
runSync
- runSync<HookName>(hookName, ...args): void
Type Parameters
- HookName extends string | number | symbol
Returns void
Registers a listener for a hook.
Returns a function that can be called to deregister the listener.