cry-synced-db-client 0.1.60 → 0.1.61
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.js +1 -10
- package/dist/src/db/SyncedDb.d.ts +7 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3311,16 +3311,7 @@ class SyncedDb {
|
|
|
3311
3311
|
this.inMemManager.deleteObjectsMetadata(collection, _ids);
|
|
3312
3312
|
}
|
|
3313
3313
|
getOrCreateWindowId() {
|
|
3314
|
-
|
|
3315
|
-
if (typeof sessionStorage !== "undefined") {
|
|
3316
|
-
let windowId = sessionStorage.getItem(storageKey);
|
|
3317
|
-
if (!windowId) {
|
|
3318
|
-
windowId = `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
3319
|
-
sessionStorage.setItem(storageKey, windowId);
|
|
3320
|
-
}
|
|
3321
|
-
return windowId;
|
|
3322
|
-
}
|
|
3323
|
-
return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
3314
|
+
return `shared-${this.tenant}`;
|
|
3324
3315
|
}
|
|
3325
3316
|
assertCollection(name) {
|
|
3326
3317
|
if (!this.collections.has(name)) {
|
|
@@ -81,9 +81,13 @@ export declare class SyncedDb implements I_SyncedDb {
|
|
|
81
81
|
deleteObjectMetadata(collection: string, _id: Id): void;
|
|
82
82
|
deleteObjectsMetadata(collection: string, _ids: Id[]): void;
|
|
83
83
|
/**
|
|
84
|
-
* Get
|
|
85
|
-
*
|
|
86
|
-
*
|
|
84
|
+
* Get the shared window ID for all tabs in the same origin.
|
|
85
|
+
* All tabs sharing the same BroadcastChannel should use the same windowId
|
|
86
|
+
* so they compete for the same leader lock.
|
|
87
|
+
*
|
|
88
|
+
* Note: "window" here means "group of tabs sharing BroadcastChannel" (same origin),
|
|
89
|
+
* not a physical browser window. sessionStorage is NOT shared between tabs,
|
|
90
|
+
* so we use a constant value to ensure all tabs compete for the same lock.
|
|
87
91
|
*/
|
|
88
92
|
private getOrCreateWindowId;
|
|
89
93
|
private assertCollection;
|