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)
})
}
this.awareness.on('change', awarenessChangeHandler)
this.awareness.on('update', awarenessChangeHandler)
this.on('update', updateHandler)
}
}

8
package-lock.json generated
View File

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

View File

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

View File

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