@chromahq/store 1.0.17 → 1.0.19
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.js +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +9 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -301,8 +301,17 @@ class BridgeStore {
|
|
|
301
301
|
this.storeName = storeName;
|
|
302
302
|
this.readyCallbacks = readyCallbacks;
|
|
303
303
|
this.setupStateSync();
|
|
304
|
+
this.setupReconnectListener();
|
|
304
305
|
this.initialize();
|
|
305
306
|
}
|
|
307
|
+
setupReconnectListener() {
|
|
308
|
+
if (this.bridge.on) {
|
|
309
|
+
this.bridge.on("bridge:connected", () => {
|
|
310
|
+
console.log(`BridgeStore[${this.storeName}]: Bridge reconnected, re-initializing...`);
|
|
311
|
+
this.forceInitialize();
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
}
|
|
306
315
|
setupStateSync() {
|
|
307
316
|
if (this.bridge.on) {
|
|
308
317
|
this.bridge.on(`store:${this.storeName}:stateChanged`, () => {
|
package/dist/index.d.ts
CHANGED
|
@@ -73,6 +73,7 @@ declare class BridgeStore<T> implements CentralStore<T> {
|
|
|
73
73
|
private initializationTimer;
|
|
74
74
|
private isInitializing;
|
|
75
75
|
constructor(bridge: BridgeWithEvents, initialState?: T, storeName?: string, readyCallbacks?: Set<() => void>);
|
|
76
|
+
private setupReconnectListener;
|
|
76
77
|
initialize: () => Promise<void>;
|
|
77
78
|
private stateSyncSequence;
|
|
78
79
|
private pendingStateSync;
|
package/dist/index.es.js
CHANGED
|
@@ -281,8 +281,17 @@ class BridgeStore {
|
|
|
281
281
|
this.storeName = storeName;
|
|
282
282
|
this.readyCallbacks = readyCallbacks;
|
|
283
283
|
this.setupStateSync();
|
|
284
|
+
this.setupReconnectListener();
|
|
284
285
|
this.initialize();
|
|
285
286
|
}
|
|
287
|
+
setupReconnectListener() {
|
|
288
|
+
if (this.bridge.on) {
|
|
289
|
+
this.bridge.on("bridge:connected", () => {
|
|
290
|
+
console.log(`BridgeStore[${this.storeName}]: Bridge reconnected, re-initializing...`);
|
|
291
|
+
this.forceInitialize();
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
}
|
|
286
295
|
setupStateSync() {
|
|
287
296
|
if (this.bridge.on) {
|
|
288
297
|
this.bridge.on(`store:${this.storeName}:stateChanged`, () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chromahq/store",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
4
|
"description": "Centralized, persistent store for Chrome extensions using zustand, accessible from service workers and React, with chrome.storage.local persistence.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs.js",
|