@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.
@@ -2495,7 +2495,8 @@ class HocuspocusProvider extends EventEmitter {
2495
2495
  this.document.on('update', this.documentUpdateHandler.bind(this));
2496
2496
  (_c = this.awareness) === null || _c === void 0 ? void 0 : _c.on('update', this.awarenessUpdateHandler.bind(this));
2497
2497
  this.registerEventListeners();
2498
- if (this.configuration.forceSyncInterval) {
2498
+ if (this.configuration.forceSyncInterval
2499
+ && typeof this.configuration.forceSyncInterval === 'number') {
2499
2500
  this.intervals.forceSync = setInterval(this.forceSync.bind(this), this.configuration.forceSyncInterval);
2500
2501
  }
2501
2502
  this.configuration.websocketProvider.attach(this);
@@ -2545,7 +2546,7 @@ class HocuspocusProvider extends EventEmitter {
2545
2546
  }
2546
2547
  }
2547
2548
  registerEventListeners() {
2548
- if (typeof window === 'undefined') {
2549
+ if (typeof window === 'undefined' || !('addEventListener' in window)) {
2549
2550
  return;
2550
2551
  }
2551
2552
  window.addEventListener('unload', this.boundPageUnload);
@@ -2697,7 +2698,7 @@ class HocuspocusProvider extends EventEmitter {
2697
2698
  this.configuration.websocketProvider.off('destroy', this.forwardDestroy);
2698
2699
  this.send(CloseMessage, { documentName: this.configuration.name });
2699
2700
  this.disconnect();
2700
- if (typeof window === 'undefined') {
2701
+ if (typeof window === 'undefined' || !('removeEventListener' in window)) {
2701
2702
  return;
2702
2703
  }
2703
2704
  window.removeEventListener('unload', this.boundPageUnload);