listen to ydoc destroy event
This commit is contained in:
parent
d9f2b28b2a
commit
253c554cf7
2 changed files with 4 additions and 1 deletions
|
@ -68,7 +68,7 @@
|
||||||
"yjs": "^13.2.0"
|
"yjs": "^13.2.0"
|
||||||
},
|
},
|
||||||
"peerDependenies": {
|
"peerDependenies": {
|
||||||
"yjs": "^13.0.0"
|
"yjs": "^13.4.6"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"ws": "^7.2.0"
|
"ws": "^7.2.0"
|
||||||
|
|
|
@ -582,6 +582,8 @@ export class WebrtcProvider extends Observable {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.connect()
|
this.connect()
|
||||||
|
this.destroy = this.destroy.bind(this)
|
||||||
|
doc.on('destroy', this.destroy)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -618,6 +620,7 @@ export class WebrtcProvider extends Observable {
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy () {
|
destroy () {
|
||||||
|
this.doc.off('destroy', this.destroy)
|
||||||
// need to wait for key before deleting room
|
// need to wait for key before deleting room
|
||||||
this.key.then(() => {
|
this.key.then(() => {
|
||||||
/** @type {Room} */ (this.room).destroy()
|
/** @type {Room} */ (this.room).destroy()
|
||||||
|
|
Loading…
Reference in a new issue