diff --git a/packages/provider/src/HocuspocusProvider.ts b/packages/provider/src/HocuspocusProvider.ts index acdda0bc..d7ca5e22 100644 --- a/packages/provider/src/HocuspocusProvider.ts +++ b/packages/provider/src/HocuspocusProvider.ts @@ -306,7 +306,7 @@ export class HocuspocusProvider extends EventEmitter { } registerEventListeners() { - if (typeof window === 'undefined') { + if (typeof window === 'undefined' || !('addEventListener' in window)) { return } @@ -506,7 +506,7 @@ export class HocuspocusProvider extends EventEmitter { this.send(CloseMessage, { documentName: this.configuration.name }) this.disconnect() - if (typeof window === 'undefined') { + if (typeof window === 'undefined' || !('removeEventListener' in window)) { return }