hookified 1.12.1 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -12
- package/dist/browser/index.global.js +615 -1
- package/dist/browser/index.global.js.map +1 -1
- package/dist/browser/index.js +616 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +640 -1
- package/dist/node/index.d.cts +35 -1
- package/dist/node/index.d.ts +35 -1
- package/dist/node/index.js +612 -1
- package/package.json +11 -11
package/dist/node/index.d.cts
CHANGED
|
@@ -161,12 +161,19 @@ type EventEmitterOptions = {
|
|
|
161
161
|
* Whether to throw an error when emit 'error' and there are no listeners. Default is false and only emits an error event.
|
|
162
162
|
*/
|
|
163
163
|
throwOnEmitError?: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Whether to throw on 'error' when there are no listeners. This is the standard functionality in EventEmitter
|
|
166
|
+
* @default false - in v2 this will be set to true by default
|
|
167
|
+
*/
|
|
168
|
+
throwOnEmptyListeners?: boolean;
|
|
164
169
|
};
|
|
165
170
|
declare class Eventified implements IEventEmitter {
|
|
166
171
|
private readonly _eventListeners;
|
|
167
172
|
private _maxListeners;
|
|
168
173
|
private _logger?;
|
|
169
174
|
private _throwOnEmitError;
|
|
175
|
+
private _throwOnEmptyListeners;
|
|
176
|
+
private _errorEvent;
|
|
170
177
|
constructor(options?: EventEmitterOptions);
|
|
171
178
|
/**
|
|
172
179
|
* Gets the logger
|
|
@@ -188,6 +195,16 @@ declare class Eventified implements IEventEmitter {
|
|
|
188
195
|
* @param {boolean} value
|
|
189
196
|
*/
|
|
190
197
|
set throwOnEmitError(value: boolean);
|
|
198
|
+
/**
|
|
199
|
+
* Gets whether an error should be thrown when emitting 'error' event with no listeners. Default is false.
|
|
200
|
+
* @returns {boolean}
|
|
201
|
+
*/
|
|
202
|
+
get throwOnEmptyListeners(): boolean;
|
|
203
|
+
/**
|
|
204
|
+
* Sets whether an error should be thrown when emitting 'error' event with no listeners. Default is false.
|
|
205
|
+
* @param {boolean} value
|
|
206
|
+
*/
|
|
207
|
+
set throwOnEmptyListeners(value: boolean);
|
|
191
208
|
/**
|
|
192
209
|
* Adds a handler function for a specific event that will run only once
|
|
193
210
|
* @param {string | symbol} eventName
|
|
@@ -305,8 +322,13 @@ type HookEntry = {
|
|
|
305
322
|
type HookifiedOptions = {
|
|
306
323
|
/**
|
|
307
324
|
* Whether an error should be thrown when a hook throws an error. Default is false and only emits an error event.
|
|
325
|
+
* @deprecated - this will be deprecated in version 2. Please use throwOnHookError.
|
|
308
326
|
*/
|
|
309
327
|
throwHookErrors?: boolean;
|
|
328
|
+
/**
|
|
329
|
+
* Whether an error should be thrown when a hook throws an error. Default is false and only emits an error event.
|
|
330
|
+
*/
|
|
331
|
+
throwOnHookError?: boolean;
|
|
310
332
|
/**
|
|
311
333
|
* Whether to enforce that all hook names start with 'before' or 'after'. Default is false.
|
|
312
334
|
* @type {boolean}
|
|
@@ -328,7 +350,7 @@ type HookifiedOptions = {
|
|
|
328
350
|
} & EventEmitterOptions;
|
|
329
351
|
declare class Hookified extends Eventified {
|
|
330
352
|
private readonly _hooks;
|
|
331
|
-
private
|
|
353
|
+
private _throwOnHookError;
|
|
332
354
|
private _enforceBeforeAfter;
|
|
333
355
|
private _deprecatedHooks;
|
|
334
356
|
private _allowDeprecated;
|
|
@@ -341,13 +363,25 @@ declare class Hookified extends Eventified {
|
|
|
341
363
|
/**
|
|
342
364
|
* Gets whether an error should be thrown when a hook throws an error. Default is false and only emits an error event.
|
|
343
365
|
* @returns {boolean}
|
|
366
|
+
* @deprecated - this will be deprecated in version 2. Please use throwOnHookError.
|
|
344
367
|
*/
|
|
345
368
|
get throwHookErrors(): boolean;
|
|
346
369
|
/**
|
|
347
370
|
* Sets whether an error should be thrown when a hook throws an error. Default is false and only emits an error event.
|
|
348
371
|
* @param {boolean} value
|
|
372
|
+
* @deprecated - this will be deprecated in version 2. Please use throwOnHookError.
|
|
349
373
|
*/
|
|
350
374
|
set throwHookErrors(value: boolean);
|
|
375
|
+
/**
|
|
376
|
+
* Gets whether an error should be thrown when a hook throws an error. Default is false and only emits an error event.
|
|
377
|
+
* @returns {boolean}
|
|
378
|
+
*/
|
|
379
|
+
get throwOnHookError(): boolean;
|
|
380
|
+
/**
|
|
381
|
+
* Sets whether an error should be thrown when a hook throws an error. Default is false and only emits an error event.
|
|
382
|
+
* @param {boolean} value
|
|
383
|
+
*/
|
|
384
|
+
set throwOnHookError(value: boolean);
|
|
351
385
|
/**
|
|
352
386
|
* Gets whether to enforce that all hook names start with 'before' or 'after'. Default is false.
|
|
353
387
|
* @returns {boolean}
|
package/dist/node/index.d.ts
CHANGED
|
@@ -161,12 +161,19 @@ type EventEmitterOptions = {
|
|
|
161
161
|
* Whether to throw an error when emit 'error' and there are no listeners. Default is false and only emits an error event.
|
|
162
162
|
*/
|
|
163
163
|
throwOnEmitError?: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Whether to throw on 'error' when there are no listeners. This is the standard functionality in EventEmitter
|
|
166
|
+
* @default false - in v2 this will be set to true by default
|
|
167
|
+
*/
|
|
168
|
+
throwOnEmptyListeners?: boolean;
|
|
164
169
|
};
|
|
165
170
|
declare class Eventified implements IEventEmitter {
|
|
166
171
|
private readonly _eventListeners;
|
|
167
172
|
private _maxListeners;
|
|
168
173
|
private _logger?;
|
|
169
174
|
private _throwOnEmitError;
|
|
175
|
+
private _throwOnEmptyListeners;
|
|
176
|
+
private _errorEvent;
|
|
170
177
|
constructor(options?: EventEmitterOptions);
|
|
171
178
|
/**
|
|
172
179
|
* Gets the logger
|
|
@@ -188,6 +195,16 @@ declare class Eventified implements IEventEmitter {
|
|
|
188
195
|
* @param {boolean} value
|
|
189
196
|
*/
|
|
190
197
|
set throwOnEmitError(value: boolean);
|
|
198
|
+
/**
|
|
199
|
+
* Gets whether an error should be thrown when emitting 'error' event with no listeners. Default is false.
|
|
200
|
+
* @returns {boolean}
|
|
201
|
+
*/
|
|
202
|
+
get throwOnEmptyListeners(): boolean;
|
|
203
|
+
/**
|
|
204
|
+
* Sets whether an error should be thrown when emitting 'error' event with no listeners. Default is false.
|
|
205
|
+
* @param {boolean} value
|
|
206
|
+
*/
|
|
207
|
+
set throwOnEmptyListeners(value: boolean);
|
|
191
208
|
/**
|
|
192
209
|
* Adds a handler function for a specific event that will run only once
|
|
193
210
|
* @param {string | symbol} eventName
|
|
@@ -305,8 +322,13 @@ type HookEntry = {
|
|
|
305
322
|
type HookifiedOptions = {
|
|
306
323
|
/**
|
|
307
324
|
* Whether an error should be thrown when a hook throws an error. Default is false and only emits an error event.
|
|
325
|
+
* @deprecated - this will be deprecated in version 2. Please use throwOnHookError.
|
|
308
326
|
*/
|
|
309
327
|
throwHookErrors?: boolean;
|
|
328
|
+
/**
|
|
329
|
+
* Whether an error should be thrown when a hook throws an error. Default is false and only emits an error event.
|
|
330
|
+
*/
|
|
331
|
+
throwOnHookError?: boolean;
|
|
310
332
|
/**
|
|
311
333
|
* Whether to enforce that all hook names start with 'before' or 'after'. Default is false.
|
|
312
334
|
* @type {boolean}
|
|
@@ -328,7 +350,7 @@ type HookifiedOptions = {
|
|
|
328
350
|
} & EventEmitterOptions;
|
|
329
351
|
declare class Hookified extends Eventified {
|
|
330
352
|
private readonly _hooks;
|
|
331
|
-
private
|
|
353
|
+
private _throwOnHookError;
|
|
332
354
|
private _enforceBeforeAfter;
|
|
333
355
|
private _deprecatedHooks;
|
|
334
356
|
private _allowDeprecated;
|
|
@@ -341,13 +363,25 @@ declare class Hookified extends Eventified {
|
|
|
341
363
|
/**
|
|
342
364
|
* Gets whether an error should be thrown when a hook throws an error. Default is false and only emits an error event.
|
|
343
365
|
* @returns {boolean}
|
|
366
|
+
* @deprecated - this will be deprecated in version 2. Please use throwOnHookError.
|
|
344
367
|
*/
|
|
345
368
|
get throwHookErrors(): boolean;
|
|
346
369
|
/**
|
|
347
370
|
* Sets whether an error should be thrown when a hook throws an error. Default is false and only emits an error event.
|
|
348
371
|
* @param {boolean} value
|
|
372
|
+
* @deprecated - this will be deprecated in version 2. Please use throwOnHookError.
|
|
349
373
|
*/
|
|
350
374
|
set throwHookErrors(value: boolean);
|
|
375
|
+
/**
|
|
376
|
+
* Gets whether an error should be thrown when a hook throws an error. Default is false and only emits an error event.
|
|
377
|
+
* @returns {boolean}
|
|
378
|
+
*/
|
|
379
|
+
get throwOnHookError(): boolean;
|
|
380
|
+
/**
|
|
381
|
+
* Sets whether an error should be thrown when a hook throws an error. Default is false and only emits an error event.
|
|
382
|
+
* @param {boolean} value
|
|
383
|
+
*/
|
|
384
|
+
set throwOnHookError(value: boolean);
|
|
351
385
|
/**
|
|
352
386
|
* Gets whether to enforce that all hook names start with 'before' or 'after'. Default is false.
|
|
353
387
|
* @returns {boolean}
|