Skip to content

Commit

Permalink
Remove _beforeUnloadHandler after destroy
Browse files Browse the repository at this point in the history
  • Loading branch information
Liquidibrium committed Apr 24, 2022
1 parent c6a88a1 commit 017b9e8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/y-webrtc.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,11 @@ export class Room {

destroy () {
this.disconnect()
if (typeof window !== 'undefined') {
window.removeEventListener('beforeunload', this._beforeUnloadHandler)
} else if (typeof process !== 'undefined') {
process.off('exit', this._beforeUnloadHandler)
}
}
}

Expand Down

0 comments on commit 017b9e8

Please sign in to comment.