@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.
@@ -1282,6 +1282,7 @@ class HocuspocusProviderWebsocket extends EventEmitter {
1282
1282
  }
1283
1283
  async onOpen(event) {
1284
1284
  this.status = WebSocketStatus.Connected;
1285
+ this.emit("status", { status: WebSocketStatus.Connected });
1285
1286
  this.cancelWebsocketRetry = undefined;
1286
1287
  this.receivedOnOpenPayload = event;
1287
1288
  }
@@ -1877,6 +1878,7 @@ class HocuspocusProvider extends EventEmitter {
1877
1878
  onMessage: () => null,
1878
1879
  onOutgoingMessage: () => null,
1879
1880
  onSynced: () => null,
1881
+ onStatus: () => null,
1880
1882
  onDisconnect: () => null,
1881
1883
  onClose: () => null,
1882
1884
  onDestroy: () => null,
@@ -1900,10 +1902,11 @@ class HocuspocusProvider extends EventEmitter {
1900
1902
  this.boundPageHide = this.pageHide.bind(this);
1901
1903
  this.boundOnOpen = this.onOpen.bind(this);
1902
1904
  this.boundOnClose = this.onClose.bind(this);
1903
- this.forwardConnect = (e) => this.emit("connect", e);
1905
+ this.forwardConnect = () => this.emit("connect");
1906
+ this.forwardStatus = (e) => this.emit("status", e);
1904
1907
  this.forwardClose = (e) => this.emit("close", e);
1905
1908
  this.forwardDisconnect = (e) => this.emit("disconnect", e);
1906
- this.forwardDestroy = (e) => this.emit("destroy", e);
1909
+ this.forwardDestroy = () => this.emit("destroy");
1907
1910
  this.setConfiguration(configuration);
1908
1911
  this.configuration.document = configuration.document
1909
1912
  ? configuration.document
@@ -2140,6 +2143,8 @@ class HocuspocusProvider extends EventEmitter {
2140
2143
  detach() {
2141
2144
  this.configuration.websocketProvider.off("connect", this.configuration.onConnect);
2142
2145
  this.configuration.websocketProvider.off("connect", this.forwardConnect);
2146
+ this.configuration.websocketProvider.off("status", this.forwardStatus);
2147
+ this.configuration.websocketProvider.off("status", this.configuration.onStatus);
2143
2148
  this.configuration.websocketProvider.off("open", this.boundOnOpen);
2144
2149
  this.configuration.websocketProvider.off("close", this.boundOnClose);
2145
2150
  this.configuration.websocketProvider.off("close", this.configuration.onClose);
@@ -2156,6 +2161,8 @@ class HocuspocusProvider extends EventEmitter {
2156
2161
  return;
2157
2162
  this.configuration.websocketProvider.on("connect", this.configuration.onConnect);
2158
2163
  this.configuration.websocketProvider.on("connect", this.forwardConnect);
2164
+ this.configuration.websocketProvider.on("status", this.configuration.onStatus);
2165
+ this.configuration.websocketProvider.on("status", this.forwardStatus);
2159
2166
  this.configuration.websocketProvider.on("open", this.boundOnOpen);
2160
2167
  this.configuration.websocketProvider.on("close", this.boundOnClose);
2161
2168
  this.configuration.websocketProvider.on("close", this.configuration.onClose);