bump y-protocols for better event handling

This commit is contained in:
Kevin Jahns 2020-06-05 04:11:14 +02:00
parent 0b897cdbfe
commit 01d8c2a3f5
4 changed files with 8 additions and 8 deletions

View File

@ -95,7 +95,7 @@ class WSSharedDoc extends Y.Doc {
send(this, c, buff) send(this, c, buff)
}) })
} }
this.awareness.on('change', awarenessChangeHandler) this.awareness.on('update', awarenessChangeHandler)
this.on('update', updateHandler) this.on('update', updateHandler)
} }
} }

8
package-lock.json generated
View File

@ -1724,11 +1724,11 @@
"dev": true "dev": true
}, },
"y-protocols": { "y-protocols": {
"version": "0.2.3", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/y-protocols/-/y-protocols-0.2.3.tgz", "resolved": "https://registry.npmjs.org/y-protocols/-/y-protocols-1.0.0.tgz",
"integrity": "sha512-mJ838iW7XgMQqlv+9DtH7QyLqflZoy/VvaUWRIpwawee4mQiFJcEXazCmSYUHEbXIUuVNNc70FnuNSMWDC5vKQ==", "integrity": "sha512-L/GB+ryTmrrE0ISLIsNmgXl8lmt+CF7wG9Gm6jQf1JQYKZuzX3+Tbz3b7ov/quXwguM5zcVlJ0zxG29SgQD5Ww==",
"requires": { "requires": {
"lib0": "^0.2.20" "lib0": "^0.2.28"
} }
}, },
"yjs": { "yjs": {

View File

@ -46,7 +46,7 @@
}, },
"dependencies": { "dependencies": {
"lib0": "^0.2.28", "lib0": "^0.2.28",
"y-protocols": "^0.2.3" "y-protocols": "^1.0.0"
}, },
"devDependencies": { "devDependencies": {
"rollup": "^1.32.1", "rollup": "^1.32.1",

View File

@ -246,7 +246,7 @@ export class WebsocketProvider extends Observable {
window.addEventListener('beforeunload', () => { window.addEventListener('beforeunload', () => {
awarenessProtocol.removeAwarenessStates(this.awareness, [doc.clientID], 'window unload') awarenessProtocol.removeAwarenessStates(this.awareness, [doc.clientID], 'window unload')
}) })
awareness.on('change', this._awarenessUpdateHandler) awareness.on('update', this._awarenessUpdateHandler)
this._checkInterval = setInterval(() => { this._checkInterval = setInterval(() => {
if (this.wsconnected && messageReconnectTimeout < time.getUnixTime() - this.wsLastMessageReceived) { if (this.wsconnected && messageReconnectTimeout < time.getUnixTime() - this.wsLastMessageReceived) {
// no message received in a long time - not even your own awareness // no message received in a long time - not even your own awareness
@ -276,7 +276,7 @@ export class WebsocketProvider extends Observable {
destroy () { destroy () {
clearInterval(this._checkInterval) clearInterval(this._checkInterval)
this.disconnect() this.disconnect()
this.awareness.off('change', this._awarenessUpdateHandler) this.awareness.off('update', this._awarenessUpdateHandler)
this.doc.off('update', this._updateHandler) this.doc.off('update', this._updateHandler)
super.destroy() super.destroy()
} }