sliftutils 0.63.0 → 0.65.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/index.d.ts CHANGED
@@ -574,6 +574,7 @@ declare module "sliftutils/storage/CBORStorage" {
574
574
  size: number;
575
575
  lastModified: number;
576
576
  } | undefined>;
577
+ watchResync(callback: () => void): void;
577
578
  reset(): Promise<void>;
578
579
  }
579
580
 
@@ -599,6 +600,7 @@ declare module "sliftutils/storage/DelayedStorage" {
599
600
  lastModified: number;
600
601
  } | undefined>;
601
602
  reset(): Promise<void>;
603
+ watchResync(callback: () => void): void;
602
604
  }
603
605
 
604
606
  }
@@ -857,6 +859,7 @@ declare module "sliftutils/storage/JSONStorage" {
857
859
  size: number;
858
860
  lastModified: number;
859
861
  } | undefined>;
862
+ watchResync(callback: () => void): void;
860
863
  reset(): Promise<void>;
861
864
  }
862
865
 
@@ -890,6 +893,7 @@ declare module "sliftutils/storage/PendingStorage" {
890
893
  private watchPending;
891
894
  private updatePending;
892
895
  reset(): Promise<void>;
896
+ watchResync(callback: () => void): void;
893
897
  }
894
898
 
895
899
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sliftutils",
3
- "version": "0.63.0",
3
+ "version": "0.65.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -12,5 +12,6 @@ export declare class CBORStorage<T> implements IStorage<T> {
12
12
  size: number;
13
13
  lastModified: number;
14
14
  } | undefined>;
15
+ watchResync(callback: () => void): void;
15
16
  reset(): Promise<void>;
16
17
  }
@@ -30,6 +30,11 @@ export class CBORStorage<T> implements IStorage<T> {
30
30
  return await this.storage.getInfo(key);
31
31
  }
32
32
 
33
+
34
+ public watchResync(callback: () => void): void {
35
+ this.storage.watchResync?.(callback);
36
+ }
37
+
33
38
  public async reset() {
34
39
  await this.storage.reset();
35
40
  }
@@ -11,4 +11,5 @@ export declare class DelayedStorage<T> implements IStorage<T> {
11
11
  lastModified: number;
12
12
  } | undefined>;
13
13
  reset(): Promise<void>;
14
+ watchResync(callback: () => void): void;
14
15
  }
@@ -27,4 +27,9 @@ export class DelayedStorage<T> implements IStorage<T> {
27
27
  const storage = await this.storage;
28
28
  return storage.reset();
29
29
  }
30
+ public watchResync(callback: () => void): void {
31
+ void this.storage.then(storage => {
32
+ storage.watchResync?.(callback);
33
+ });
34
+ }
30
35
  }
@@ -12,5 +12,6 @@ export declare class JSONStorage<T> implements IStorage<T> {
12
12
  size: number;
13
13
  lastModified: number;
14
14
  } | undefined>;
15
+ watchResync(callback: () => void): void;
15
16
  reset(): Promise<void>;
16
17
  }
@@ -27,7 +27,9 @@ export class JSONStorage<T> implements IStorage<T> {
27
27
  }
28
28
 
29
29
 
30
-
30
+ public watchResync(callback: () => void): void {
31
+ this.storage.watchResync?.(callback);
32
+ }
31
33
 
32
34
  public async reset() {
33
35
  await this.storage.reset();
@@ -15,4 +15,5 @@ export declare class PendingStorage<T> implements IStorage<T> {
15
15
  private watchPending;
16
16
  private updatePending;
17
17
  reset(): Promise<void>;
18
+ watchResync(callback: () => void): void;
18
19
  }
@@ -44,4 +44,7 @@ export class PendingStorage<T> implements IStorage<T> {
44
44
  public async reset() {
45
45
  return this.storage.reset();
46
46
  }
47
+ public watchResync(callback: () => void): void {
48
+ this.storage.watchResync?.(callback);
49
+ }
47
50
  }