@shaxpir/duiduidui-models 1.6.15 → 1.6.16
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/repo/ShareSync.d.ts +2 -0
- package/dist/repo/ShareSync.js +28 -0
- package/package.json +1 -1
package/dist/repo/ShareSync.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export declare class ShareSyncFactory {
|
|
|
29
29
|
private static INSTANCE;
|
|
30
30
|
static initialize(encryption: Encryption, options: ShareSyncOptions): void;
|
|
31
31
|
static get(): ShareSync;
|
|
32
|
+
static shutdown(): void;
|
|
32
33
|
}
|
|
33
34
|
export declare class ShareSync {
|
|
34
35
|
private _debug;
|
|
@@ -78,4 +79,5 @@ export declare class ShareSync {
|
|
|
78
79
|
setAutoBatchEnabled(enabled: boolean): void;
|
|
79
80
|
isAutoBatchEnabled(): boolean;
|
|
80
81
|
flush(): void;
|
|
82
|
+
shutdown(): void;
|
|
81
83
|
}
|
package/dist/repo/ShareSync.js
CHANGED
|
@@ -67,6 +67,12 @@ class ShareSyncFactory {
|
|
|
67
67
|
static get() {
|
|
68
68
|
return ShareSyncFactory.INSTANCE;
|
|
69
69
|
}
|
|
70
|
+
static shutdown() {
|
|
71
|
+
if (ShareSyncFactory.INSTANCE) {
|
|
72
|
+
ShareSyncFactory.INSTANCE.shutdown();
|
|
73
|
+
ShareSyncFactory.INSTANCE = null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
70
76
|
}
|
|
71
77
|
exports.ShareSyncFactory = ShareSyncFactory;
|
|
72
78
|
ShareSyncFactory.INSTANCE = null;
|
|
@@ -464,5 +470,27 @@ class ShareSync {
|
|
|
464
470
|
this._durableStore.flush();
|
|
465
471
|
}
|
|
466
472
|
}
|
|
473
|
+
shutdown() {
|
|
474
|
+
console.log('[ShareSync] Shutting down...');
|
|
475
|
+
// Close the WebSocket connection
|
|
476
|
+
if (this._socket) {
|
|
477
|
+
this._socket.close();
|
|
478
|
+
this._socket = null;
|
|
479
|
+
}
|
|
480
|
+
// Close the ShareDB connection
|
|
481
|
+
if (this._connection) {
|
|
482
|
+
this._connection.close();
|
|
483
|
+
this._connection = null;
|
|
484
|
+
}
|
|
485
|
+
// Clear the model cache
|
|
486
|
+
if (this._modelCache) {
|
|
487
|
+
this._modelCache.clear();
|
|
488
|
+
}
|
|
489
|
+
// Clear DurableStore references
|
|
490
|
+
this._storage = null;
|
|
491
|
+
this._durableStore = null;
|
|
492
|
+
this._storageFactory = null;
|
|
493
|
+
console.log('[ShareSync] Shutdown complete');
|
|
494
|
+
}
|
|
467
495
|
}
|
|
468
496
|
exports.ShareSync = ShareSync;
|