@hocuspocus/provider 2.12.2 → 2.13.0

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.
@@ -2519,7 +2519,8 @@ class HocuspocusProvider extends EventEmitter {
2519
2519
  this.document.on('update', this.documentUpdateHandler.bind(this));
2520
2520
  (_c = this.awareness) === null || _c === void 0 ? void 0 : _c.on('update', this.awarenessUpdateHandler.bind(this));
2521
2521
  this.registerEventListeners();
2522
- if (this.configuration.forceSyncInterval) {
2522
+ if (this.configuration.forceSyncInterval
2523
+ && typeof this.configuration.forceSyncInterval === 'number') {
2523
2524
  this.intervals.forceSync = setInterval(this.forceSync.bind(this), this.configuration.forceSyncInterval);
2524
2525
  }
2525
2526
  this.configuration.websocketProvider.attach(this);
@@ -2569,7 +2570,7 @@ class HocuspocusProvider extends EventEmitter {
2569
2570
  }
2570
2571
  }
2571
2572
  registerEventListeners() {
2572
- if (typeof window === 'undefined') {
2573
+ if (typeof window === 'undefined' || !('addEventListener' in window)) {
2573
2574
  return;
2574
2575
  }
2575
2576
  window.addEventListener('unload', this.boundPageUnload);
@@ -2721,7 +2722,7 @@ class HocuspocusProvider extends EventEmitter {
2721
2722
  this.configuration.websocketProvider.off('destroy', this.forwardDestroy);
2722
2723
  this.send(CloseMessage, { documentName: this.configuration.name });
2723
2724
  this.disconnect();
2724
- if (typeof window === 'undefined') {
2725
+ if (typeof window === 'undefined' || !('removeEventListener' in window)) {
2725
2726
  return;
2726
2727
  }
2727
2728
  window.removeEventListener('unload', this.boundPageUnload);