y-websocket
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -233,13 +233,10 @@ 'use strict'; | ||
this._awarenessUpdateHandler = ({ added, updated, removed }, origin) => { | ||
const changedClients = added.concat(updated).concat(removed); | ||
const encoder = encoding.createEncoder(); | ||
encoding.writeVarUint(encoder, messageAwareness); | ||
encoding.writeVarUint8Array(encoder, awarenessProtocol.encodeAwarenessUpdate(awareness, [doc.clientID])); | ||
encoding.writeVarUint8Array(encoder, awarenessProtocol.encodeAwarenessUpdate(awareness, changedClients)); | ||
broadcastMessage(this, encoding.toUint8Array(encoder)); | ||
}; | ||
window.addEventListener('beforeunload', () => { | ||
// broadcast message with local awareness state set to null (indicating disconnect) | ||
const encoder = encoding.createEncoder(); | ||
encoding.writeVarUint(encoder, messageAwareness); | ||
encoding.writeVarUint8Array(encoder, awarenessProtocol.encodeAwarenessUpdate(this.awareness, [this.doc.clientID], new Map())); | ||
broadcastMessage(this, encoding.toUint8Array(encoder)); | ||
awarenessProtocol.removeAwarenessStates(this.awareness, [doc.clientID], 'window unload'); | ||
}); | ||
@@ -246,0 +243,0 @@ awareness.on('change', this._awarenessUpdateHandler); |
{ | ||
"name": "y-websocket", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Websockets provider for Yjs", | ||
@@ -5,0 +5,0 @@ "main": "./dist/y-websocket.js", |
@@ -235,13 +235,10 @@ /* | ||
this._awarenessUpdateHandler = ({ added, updated, removed }, origin) => { | ||
const changedClients = added.concat(updated).concat(removed) | ||
const encoder = encoding.createEncoder() | ||
encoding.writeVarUint(encoder, messageAwareness) | ||
encoding.writeVarUint8Array(encoder, awarenessProtocol.encodeAwarenessUpdate(awareness, [doc.clientID])) | ||
encoding.writeVarUint8Array(encoder, awarenessProtocol.encodeAwarenessUpdate(awareness, changedClients)) | ||
broadcastMessage(this, encoding.toUint8Array(encoder)) | ||
} | ||
window.addEventListener('beforeunload', () => { | ||
// broadcast message with local awareness state set to null (indicating disconnect) | ||
const encoder = encoding.createEncoder() | ||
encoding.writeVarUint(encoder, messageAwareness) | ||
encoding.writeVarUint8Array(encoder, awarenessProtocol.encodeAwarenessUpdate(this.awareness, [this.doc.clientID], new Map())) | ||
broadcastMessage(this, encoding.toUint8Array(encoder)) | ||
awarenessProtocol.removeAwarenessStates(this.awareness, [doc.clientID], 'window unload') | ||
}) | ||
@@ -248,0 +245,0 @@ awareness.on('change', this._awarenessUpdateHandler) |
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
56301
859