y-websocket
Advanced tools
Comparing version 1.3.15 to 1.3.16
@@ -87,2 +87,3 @@ /** | ||
_awarenessUpdateHandler: ({ added, updated, removed }: any, origin: any) => void; | ||
_beforeUnloadHandler: () => void; | ||
_checkInterval: any; | ||
@@ -89,0 +90,0 @@ set synced(arg: boolean); |
{ | ||
"name": "y-websocket", | ||
"version": "1.3.15", | ||
"version": "1.3.16", | ||
"description": "Websockets provider for Yjs", | ||
@@ -5,0 +5,0 @@ "main": "./dist/y-websocket.cjs", |
@@ -279,6 +279,9 @@ /* | ||
} | ||
this._beforeUnloadHandler = () => { | ||
awarenessProtocol.removeAwarenessStates(this.awareness, [doc.clientID], 'window unload') | ||
} | ||
if (typeof window !== 'undefined') { | ||
window.addEventListener('beforeunload', () => { | ||
awarenessProtocol.removeAwarenessStates(this.awareness, [doc.clientID], 'window unload') | ||
}) | ||
window.addEventListener('beforeunload', this._beforeUnloadHandler) | ||
} else if (typeof process !== 'undefined') { | ||
process.on('exit', () => this._beforeUnloadHandler) | ||
} | ||
@@ -319,2 +322,7 @@ awareness.on('update', this._awarenessUpdateHandler) | ||
this.disconnect() | ||
if (typeof window !== 'undefined') { | ||
window.removeEventListener('beforeunload', this._beforeUnloadHandler) | ||
} else if (typeof process !== 'undefined') { | ||
process.off('exit', () => this._beforeUnloadHandler) | ||
} | ||
this.awareness.off('update', this._awarenessUpdateHandler) | ||
@@ -321,0 +329,0 @@ this.doc.off('update', this._updateHandler) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
78371
1183