add clear state function.

This commit is contained in:
Miroslav Šedivý 2020-12-03 20:16:24 +01:00
parent 7f038140e3
commit 052eb3cade

View File

@ -281,19 +281,9 @@
this.websocket.on('disconnected', () => {
Vue.set(this.state.connection, 'websocket', 'disconnected')
this.events.emit('internal.websocket', 'disconnected')
this.webrtc.disconnect()
// TODO: reset state
Vue.set(this.state, 'member', {
id: null,
name: null,
is_admin: false,
is_watching: false,
is_controlling: false,
can_watch: false,
can_control: false,
clipboard_access: false,
})
this.webrtc.disconnect()
this.clearState()
})
// webrtc
@ -370,5 +360,15 @@
this._container.style.marginLeft = `0px`
}
}
clearState() {
Vue.set(this.state.control, 'clipboard', null)
Vue.set(this.state.control, 'host_id', null)
Vue.set(this.state.control, 'implicit_hosting', false)
Vue.set(this.state.screen, 'size', { width: 1280, height: 720, rate: 30 })
Vue.set(this.state.screen, 'configurations', [])
Vue.set(this.state, 'member_id', null)
Vue.set(this.state, 'members', {})
}
}
</script>