Skip to content

Commit

Permalink
fix: improve global window checks to enable react native support
Browse files Browse the repository at this point in the history
  • Loading branch information
Amorim33 committed May 16, 2024
1 parent 1af781a commit f7d454d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/provider/src/HocuspocusProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ export class HocuspocusProvider extends EventEmitter {
}

registerEventListeners() {
if (typeof window === 'undefined') {
if (typeof window === 'undefined' || !('addEventListener' in window)) {
return
}

Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit f7d454d

Please sign in to comment.