revojs 0.2.2 → 0.2.4

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/package.js CHANGED
@@ -1,6 +1,6 @@
1
1
  //#region package.json
2
2
  var name = "revojs";
3
- var version = "0.2.2";
3
+ var version = "0.2.4";
4
4
  var repository = {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/tellua/revojs.git"
@@ -21,7 +21,7 @@ export interface Scope {
21
21
  context: Record<string, unknown>;
22
22
  }
23
23
  export declare function registerHook<T extends Hook>(scope: Scope, name: Descriptor<T>, invoke: T): () => void;
24
- export declare function createRegisterHooks<T extends Record<string, Descriptor<Hook>>>(descriptors: T): (scope: Scope, hooks: Hooks<T>) => void;
24
+ export declare function createRegisterHooks<T extends Record<string, Descriptor<Hook>>>(descriptors: T): (scope: Scope, hooks: Partial<Hooks<T>>) => void;
25
25
  export declare function dispatchHook<T extends Hook>(scope: Scope, name: Descriptor<T>, ...inputs: Parameters<T>): Promise<Awaited<ReturnType<T>>[]>;
26
26
  export declare function dispatchHookSingle<T extends Hook>(scope: Scope, name: Descriptor<T>, ...inputs: Parameters<T>): Promise<ReturnType<T> | undefined>;
27
27
  export declare function getContext<T>(scope: Scope, input: Descriptor<T>): T;
@@ -14,7 +14,10 @@ function registerHook(scope, name, invoke) {
14
14
  }
15
15
  function createRegisterHooks(descriptors) {
16
16
  return (scope, hooks) => {
17
- for (const name in descriptors) registerHook(scope, descriptors[name], hooks[name]);
17
+ for (const name in descriptors) {
18
+ const hook = hooks[name];
19
+ if (hook) registerHook(scope, descriptors[name], hook);
20
+ }
18
21
  };
19
22
  }
20
23
  async function dispatchHook(scope, name, ...inputs) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "revojs",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",