* Registers a new hook function under the specified hook name. * This function should be a function that takes an argument of type `T` and returns a `string` or `Promise `. * * @template Hook - The type of the hook name. It should be one of the keys of `HooksMapping`. * @param nam
(name: Hook, handler: HooksMapping[Hook])
| 103 | * ``` |
| 104 | */ |
| 105 | on<Hook extends HookName>(name: Hook, handler: HooksMapping[Hook]): void { |
| 106 | const hooks = this.store.get(name); |
| 107 | if (hooks) { |
| 108 | hooks.push(handler); |
| 109 | } else { |
| 110 | this.store.set(name, [handler]); |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * Checks if there are any hooks registered under the specified name. |
no test coverage detected