add id to room.control.host.

This commit is contained in:
Miroslav Šedivý 2024-05-06 23:41:21 +02:00
parent 2536b49568
commit 7998018cb8
3 changed files with 6 additions and 5 deletions

View File

@ -36,7 +36,7 @@ export interface NekoEvents {
['session.updated']: (id: string) => void ['session.updated']: (id: string) => void
// room events // room events
['room.control.host']: (hasHost: boolean, hostID?: string) => void ['room.control.host']: (hasHost: boolean, hostID: string | undefined, id: string) => void
['room.screen.updated']: (width: number, height: number, rate: number, id: string) => void ['room.screen.updated']: (width: number, height: number, rate: number, id: string) => void
['room.settings.updated']: (settings: Settings, id: string) => void ['room.settings.updated']: (settings: Settings, id: string) => void
['room.clipboard.updated']: (text: string) => void ['room.clipboard.updated']: (text: string) => void
@ -263,7 +263,7 @@ export class NekoMessages extends EventEmitter<NekoEvents> {
// Control Events // Control Events
///////////////////////////// /////////////////////////////
protected [EVENT.CONTROL_HOST]({ has_host, host_id }: message.ControlHost) { protected [EVENT.CONTROL_HOST]({ has_host, host_id, id }: message.ControlHost) {
this._localLog.debug(`EVENT.CONTROL_HOST`) this._localLog.debug(`EVENT.CONTROL_HOST`)
if (has_host && host_id) { if (has_host && host_id) {
@ -275,7 +275,7 @@ export class NekoMessages extends EventEmitter<NekoEvents> {
// save if user is host // save if user is host
this._state.control.is_host = has_host && this._state.control.host_id === this._state.session_id // TODO: Vue.Set this._state.control.is_host = has_host && this._state.control.host_id === this._state.session_id // TODO: Vue.Set
this.emit('room.control.host', has_host, host_id) this.emit('room.control.host', has_host, host_id, id)
} }
///////////////////////////// /////////////////////////////

View File

@ -111,6 +111,7 @@ export interface SessionCursor {
///////////////////////////// /////////////////////////////
export interface ControlHost { export interface ControlHost {
id: string
has_host: boolean has_host: boolean
host_id: string | undefined host_id: string | undefined
} }

View File

@ -494,8 +494,8 @@ onMounted(() => {
// //
// room events // room events
// //
neko.value!.events.on('room.control.host', (hasHost: boolean, hostID?: string) => { neko.value!.events.on('room.control.host', (hasHost: boolean, hostID: string | undefined, id: string) => {
console.log('room.control.host', hasHost, hostID) console.log('room.control.host', hasHost, hostID, 'by', id)
}) })
neko.value!.events.on('room.screen.updated', (width: number, height: number, rate: number, id: string) => { neko.value!.events.on('room.screen.updated', (width: number, height: number, rate: number, id: string) => {
console.log('room.screen.updated', width, height, rate, 'by', id) console.log('room.screen.updated', width, height, rate, 'by', id)