cross-state 0.45.1 → 0.46.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.
@@ -55,7 +55,9 @@ export declare class Store<T> extends Callable<any, any> {
55
55
  set(update: Update<T>): void;
56
56
  set<const P>(path: Constrain<P, Path<T>>, update: Update<Value<T, P>>): void;
57
57
  invalidate(recursive?: boolean): void;
58
- subscribe(listener: Listener<T>, options?: SubscribeOptions): DisposableCancel;
58
+ subscribe(listener: Listener<T, {
59
+ cancel: Cancel;
60
+ }>, options?: SubscribeOptions): DisposableCancel;
59
61
  once<S extends T>(condition: (value: T) => value is S, options?: OnceOptions): PromiseWithCancel<S>;
60
62
  once(condition: (value: T) => boolean, options?: OnceOptions): PromiseWithCancel<T>;
61
63
  once(options?: OnceOptions): PromiseWithCancel<T>;
@@ -1,4 +1,4 @@
1
- import type { DisposableCancel, SubscribeOptions } from '../core/commonTypes';
1
+ import type { Cancel, DisposableCancel, SubscribeOptions } from '../core/commonTypes';
2
2
  import type { Store } from '../core/store';
3
3
  import { type DiffOptions, type Patch } from '../lib/diff';
4
4
  export interface SyncMessage {
@@ -29,7 +29,9 @@ export type InteropPatch = Patch | {
29
29
  op: 'add' | 'replace' | 'remove';
30
30
  value?: any;
31
31
  };
32
- export declare function subscribePatches<T>(this: Store<T>, listener: (patches: Patch[], reversePatches: Patch[], version: string, previousVersion: string | undefined) => void, options?: SubscribePatchOptions): DisposableCancel;
32
+ export declare function subscribePatches<T>(this: Store<T>, listener: (this: {
33
+ cancel: Cancel;
34
+ }, patches: Patch[], reversePatches: Patch[], version: string, previousVersion: string | undefined) => void, options?: SubscribePatchOptions): DisposableCancel;
33
35
  export declare function applyPatches<T>(this: Store<T>, patches: InteropPatch[]): void;
34
36
  export declare function applyPatches<T>(this: Store<T>, ...patches: InteropPatch[]): void;
35
37
  export declare function sync<T>(this: Store<T>, listener: (syncMessage: SyncMessage) => void, options?: Omit<SubscribePatchOptions, 'runNow'>): DisposableCancel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cross-state",
3
- "version": "0.45.1",
3
+ "version": "0.46.0",
4
4
  "description": "(React) state library",
5
5
  "license": "ISC",
6
6
  "repository": "schummar/cross-state",