shelving 1.58.0 → 1.59.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/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "state-management",
12
12
  "query-builder"
13
13
  ],
14
- "version": "1.58.0",
14
+ "version": "1.59.0",
15
15
  "repository": "https://github.com/dhoulb/shelving",
16
16
  "author": "Dave Houlbrooke <dave@shax.com>",
17
17
  "license": "0BSD",
@@ -13,7 +13,9 @@ export declare type Dispatcher<T extends Arguments = []> = (...value: T) => void
13
13
  /** Function that receives a dispatched value. */
14
14
  export declare type AsyncDispatcher<T extends Arguments = []> = (...value: T) => void | PromiseLike<void>;
15
15
  /** Safely dispatch a value to a dispatcher function. */
16
- export declare function dispatch<T extends Arguments>(dispatcher: AsyncDispatcher<T>, ...value: T): void;
16
+ export declare function dispatch<A extends Arguments>(dispatcher: AsyncDispatcher<A>, ...value: A): void;
17
+ /** Return a function that dispatches a value to a dispatcher function. */
18
+ export declare function dispatched<A extends Arguments>(dispatcher: AsyncDispatcher<A>): Dispatcher<A>;
17
19
  /** Safely dispatch a value to a dispatcher method on an object. */
18
20
  export declare function dispatchMethod<T extends Arguments, M extends string | symbol>(obj: {
19
21
  [K in M]: AsyncDispatcher<T>;
package/util/function.js CHANGED
@@ -17,6 +17,10 @@ export function dispatch(dispatcher, ...value) {
17
17
  logError(thrown);
18
18
  }
19
19
  }
20
+ /** Return a function that dispatches a value to a dispatcher function. */
21
+ export function dispatched(dispatcher) {
22
+ return (...args) => dispatch(dispatcher, ...args);
23
+ }
20
24
  /** Safely dispatch a value to a dispatcher method on an object. */
21
25
  export function dispatchMethod(obj, key, ...value) {
22
26
  try {