@hocuspocus/provider 3.2.3 → 3.2.5

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.
@@ -1303,6 +1303,7 @@ class HocuspocusProviderWebsocket extends EventEmitter {
1303
1303
  }
1304
1304
  async onOpen(event) {
1305
1305
  this.status = exports.WebSocketStatus.Connected;
1306
+ this.emit("status", { status: exports.WebSocketStatus.Connected });
1306
1307
  this.cancelWebsocketRetry = undefined;
1307
1308
  this.receivedOnOpenPayload = event;
1308
1309
  }
@@ -1898,6 +1899,7 @@ class HocuspocusProvider extends EventEmitter {
1898
1899
  onMessage: () => null,
1899
1900
  onOutgoingMessage: () => null,
1900
1901
  onSynced: () => null,
1902
+ onStatus: () => null,
1901
1903
  onDisconnect: () => null,
1902
1904
  onClose: () => null,
1903
1905
  onDestroy: () => null,
@@ -1921,10 +1923,11 @@ class HocuspocusProvider extends EventEmitter {
1921
1923
  this.boundPageHide = this.pageHide.bind(this);
1922
1924
  this.boundOnOpen = this.onOpen.bind(this);
1923
1925
  this.boundOnClose = this.onClose.bind(this);
1924
- this.forwardConnect = (e) => this.emit("connect", e);
1926
+ this.forwardConnect = () => this.emit("connect");
1927
+ this.forwardStatus = (e) => this.emit("status", e);
1925
1928
  this.forwardClose = (e) => this.emit("close", e);
1926
1929
  this.forwardDisconnect = (e) => this.emit("disconnect", e);
1927
- this.forwardDestroy = (e) => this.emit("destroy", e);
1930
+ this.forwardDestroy = () => this.emit("destroy");
1928
1931
  this.setConfiguration(configuration);
1929
1932
  this.configuration.document = configuration.document
1930
1933
  ? configuration.document
@@ -2161,6 +2164,8 @@ class HocuspocusProvider extends EventEmitter {
2161
2164
  detach() {
2162
2165
  this.configuration.websocketProvider.off("connect", this.configuration.onConnect);
2163
2166
  this.configuration.websocketProvider.off("connect", this.forwardConnect);
2167
+ this.configuration.websocketProvider.off("status", this.forwardStatus);
2168
+ this.configuration.websocketProvider.off("status", this.configuration.onStatus);
2164
2169
  this.configuration.websocketProvider.off("open", this.boundOnOpen);
2165
2170
  this.configuration.websocketProvider.off("close", this.boundOnClose);
2166
2171
  this.configuration.websocketProvider.off("close", this.configuration.onClose);
@@ -2177,6 +2182,8 @@ class HocuspocusProvider extends EventEmitter {
2177
2182
  return;
2178
2183
  this.configuration.websocketProvider.on("connect", this.configuration.onConnect);
2179
2184
  this.configuration.websocketProvider.on("connect", this.forwardConnect);
2185
+ this.configuration.websocketProvider.on("status", this.configuration.onStatus);
2186
+ this.configuration.websocketProvider.on("status", this.forwardStatus);
2180
2187
  this.configuration.websocketProvider.on("open", this.boundOnOpen);
2181
2188
  this.configuration.websocketProvider.on("close", this.boundOnClose);
2182
2189
  this.configuration.websocketProvider.on("close", this.configuration.onClose);