y-websocket
Advanced tools
Comparing version 1.5.1 to 1.5.2
@@ -104,3 +104,3 @@ export const messageSync: 0; | ||
_awarenessUpdateHandler: ({ added, updated, removed }: any, _origin: any) => void; | ||
_unloadHandler: () => void; | ||
_exitHandler: () => void; | ||
_checkInterval: any; | ||
@@ -107,0 +107,0 @@ set synced(arg: boolean); |
{ | ||
"name": "y-websocket", | ||
"version": "1.5.1", | ||
"version": "1.5.2", | ||
"description": "Websockets provider for Yjs", | ||
@@ -5,0 +5,0 @@ "main": "./dist/y-websocket.cjs", |
@@ -353,13 +353,11 @@ /** | ||
} | ||
this._unloadHandler = () => { | ||
this._exitHandler = () => { | ||
awarenessProtocol.removeAwarenessStates( | ||
this.awareness, | ||
[doc.clientID], | ||
'window unload' | ||
'app closed' | ||
) | ||
} | ||
if (typeof window !== 'undefined') { | ||
window.addEventListener('unload', this._unloadHandler) | ||
} else if (typeof process !== 'undefined') { | ||
process.on('exit', this._unloadHandler) | ||
if (typeof process !== 'undefined') { | ||
process.on('exit', this._exitHandler) | ||
} | ||
@@ -404,6 +402,4 @@ awareness.on('update', this._awarenessUpdateHandler) | ||
this.disconnect() | ||
if (typeof window !== 'undefined') { | ||
window.removeEventListener('unload', this._unloadHandler) | ||
} else if (typeof process !== 'undefined') { | ||
process.off('exit', this._unloadHandler) | ||
if (typeof process !== 'undefined') { | ||
process.off('exit', this._exitHandler) | ||
} | ||
@@ -410,0 +406,0 @@ this.awareness.off('update', this._awarenessUpdateHandler) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
85191
1436