hookable 5.2.0 → 5.2.1
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/dist/index.cjs +4 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +4 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -166,7 +166,10 @@ class Hookable {
|
|
|
166
166
|
if (this._after) {
|
|
167
167
|
callEachWith(this._after, event);
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
if (result instanceof Promise) {
|
|
170
|
+
return result;
|
|
171
|
+
}
|
|
172
|
+
return Promise.resolve(result);
|
|
170
173
|
}
|
|
171
174
|
beforeEach(fn) {
|
|
172
175
|
this._before = this._before || [];
|
package/dist/index.d.ts
CHANGED
|
@@ -56,9 +56,9 @@ declare class Hookable<HooksT = Record<string, HookCallback>, HookNameT extends
|
|
|
56
56
|
deprecateHooks(deprecatedHooks: Partial<Record<HookNameT, DeprecatedHook<HooksT>>>): void;
|
|
57
57
|
addHooks(configHooks: NestedHooks<HooksT>): () => void;
|
|
58
58
|
removeHooks(configHooks: NestedHooks<HooksT>): void;
|
|
59
|
-
callHook<NameT extends HookNameT>(name: NameT, ...args: Parameters<InferCallback<HooksT, NameT>>):
|
|
60
|
-
callHookParallel<NameT extends HookNameT>(name: NameT, ...args: Parameters<InferCallback<HooksT, NameT>>):
|
|
61
|
-
callHookWith<NameT extends HookNameT, CallFunction extends (hooks: HookCallback[], args: Parameters<InferCallback<HooksT, NameT>>) => any>(caller: CallFunction, name: NameT, ...args: Parameters<InferCallback<HooksT, NameT>>):
|
|
59
|
+
callHook<NameT extends HookNameT>(name: NameT, ...args: Parameters<InferCallback<HooksT, NameT>>): Promise<any>;
|
|
60
|
+
callHookParallel<NameT extends HookNameT>(name: NameT, ...args: Parameters<InferCallback<HooksT, NameT>>): Promise<any[]>;
|
|
61
|
+
callHookWith<NameT extends HookNameT, CallFunction extends (hooks: HookCallback[], args: Parameters<InferCallback<HooksT, NameT>>) => any>(caller: CallFunction, name: NameT, ...args: Parameters<InferCallback<HooksT, NameT>>): ReturnType<CallFunction>;
|
|
62
62
|
beforeEach(fn: (event: InferSpyEvent<HooksT>) => void): void;
|
|
63
63
|
afterEach(fn: (event: InferSpyEvent<HooksT>) => void): void;
|
|
64
64
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -162,7 +162,10 @@ class Hookable {
|
|
|
162
162
|
if (this._after) {
|
|
163
163
|
callEachWith(this._after, event);
|
|
164
164
|
}
|
|
165
|
-
|
|
165
|
+
if (result instanceof Promise) {
|
|
166
|
+
return result;
|
|
167
|
+
}
|
|
168
|
+
return Promise.resolve(result);
|
|
166
169
|
}
|
|
167
170
|
beforeEach(fn) {
|
|
168
171
|
this._before = this._before || [];
|