Skip to content
Snippets Groups Projects
Commit c402c886 authored by Moritz Langenstein's avatar Moritz Langenstein
Browse files

(ml5717) Disconnect from current room on new room connection

parent 81e7ca99
No related branches found
No related tags found
No related merge requests found
......@@ -107,15 +107,12 @@ function showConnectedRoom(roomID) {
setElemVisible(HTML.connectedRoomInfoContainer)
}
function removeAllChildrenNodes(element) {
while (element.firstChild) {
element.removeChild(element.firstChild)
function setBlankUIState() {
while (HTML.canvas.children[1]) {
HTML.canvas.removeChild(HTML.canvas.children[1])
}
}
function setBlankUIState() {
removeAllChildrenNodes(HTML.canvas)
removeAllChildrenNodes(HTML.connectedPeers)
HTML.connectedPeers.innerHTML = "No peers are connected"
}
function handleRoomConnectClick() {
......@@ -277,6 +274,7 @@ function handleRoomConnectionEstablished(room) {
HTML.penButton.removeEventListener("click", penButtonOnClick)
HTML.eraserButton.removeEventListener("click", eraserButtonOnClick)
room.disconnect()
room = undefined
handleRoomConnectClick()
......
......@@ -19,6 +19,10 @@ class Room extends EventTarget {
this.ownID = null
}
disconnect() {
this._y.destroy()
}
addPath([x, y]) {
const id = uuidv4()
this._y.share.strokeAdd.set(id, Y.Array).push([[x, y]])
......
Subproject commit d30d6db92c8930e7d2381846d3c161b1a787393b
Subproject commit ba068ea6a62d6a124047fd3dd0075adecd5d149a
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment