@liveblocks/core 2.18.0 → 2.18.1

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.d.mts CHANGED
@@ -2090,6 +2090,12 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
2090
2090
  readonly storageStatus: Observable<StorageStatus>;
2091
2091
  readonly ydoc: Observable<YDocUpdateServerMsg | UpdateYDocClientMsg>;
2092
2092
  readonly comments: Observable<CommentsEventServerMsg>;
2093
+ /**
2094
+ * Called right before the room is destroyed. The event cannot be used to
2095
+ * prevent the room from being destroyed, only to be informed that this is
2096
+ * imminent.
2097
+ */
2098
+ readonly roomWillDestroy: Observable<void>;
2093
2099
  };
2094
2100
  /**
2095
2101
  * Batches modifications made during the given function.
package/dist/index.d.ts CHANGED
@@ -2090,6 +2090,12 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
2090
2090
  readonly storageStatus: Observable<StorageStatus>;
2091
2091
  readonly ydoc: Observable<YDocUpdateServerMsg | UpdateYDocClientMsg>;
2092
2092
  readonly comments: Observable<CommentsEventServerMsg>;
2093
+ /**
2094
+ * Called right before the room is destroyed. The event cannot be used to
2095
+ * prevent the room from being destroyed, only to be informed that this is
2096
+ * imminent.
2097
+ */
2098
+ readonly roomWillDestroy: Observable<void>;
2093
2099
  };
2094
2100
  /**
2095
2101
  * Batches modifications made during the given function.
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ var __export = (target, all) => {
6
6
 
7
7
  // src/version.ts
8
8
  var PKG_NAME = "@liveblocks/core";
9
- var PKG_VERSION = "2.18.0";
9
+ var PKG_VERSION = "2.18.1";
10
10
  var PKG_FORMAT = "cjs";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -6611,7 +6611,8 @@ function createRoom(options, config) {
6611
6611
  storageDidLoad: makeEventSource(),
6612
6612
  storageStatus: makeEventSource(),
6613
6613
  ydoc: makeEventSource(),
6614
- comments: makeEventSource()
6614
+ comments: makeEventSource(),
6615
+ roomWillDestroy: makeEventSource()
6615
6616
  };
6616
6617
  const roomId = config.roomId;
6617
6618
  async function createTextMention(userId, mentionId) {
@@ -7516,7 +7517,8 @@ ${Array.from(traces).join("\n\n")}`
7516
7517
  storageDidLoad: eventHub.storageDidLoad.observable,
7517
7518
  storageStatus: eventHub.storageStatus.observable,
7518
7519
  ydoc: eventHub.ydoc.observable,
7519
- comments: eventHub.comments.observable
7520
+ comments: eventHub.comments.observable,
7521
+ roomWillDestroy: eventHub.roomWillDestroy.observable
7520
7522
  };
7521
7523
  async function getThreadsSince(options2) {
7522
7524
  return httpClient.getThreadsSince({
@@ -7710,11 +7712,17 @@ ${Array.from(traces).join("\n\n")}`
7710
7712
  reconnect: () => managedSocket.reconnect(),
7711
7713
  disconnect: () => managedSocket.disconnect(),
7712
7714
  destroy: () => {
7713
- syncSourceForStorage.destroy();
7715
+ const { roomWillDestroy, ...eventsExceptDestroy } = eventHub;
7716
+ for (const source of Object.values(eventsExceptDestroy)) {
7717
+ source[Symbol.dispose]();
7718
+ }
7719
+ eventHub.roomWillDestroy.notify();
7714
7720
  _optionalChain([context, 'access', _166 => _166.yjsProvider, 'optionalAccess', _167 => _167.off, 'call', _168 => _168("status", yjsStatusDidChange)]);
7721
+ syncSourceForStorage.destroy();
7715
7722
  syncSourceForYjs.destroy();
7716
7723
  uninstallBgTabSpy();
7717
7724
  managedSocket.destroy();
7725
+ roomWillDestroy[Symbol.dispose]();
7718
7726
  },
7719
7727
  // Presence
7720
7728
  updatePresence,