add file chooser upload.

This commit is contained in:
Miroslav Šedivý 2021-01-20 23:59:32 +01:00
parent ed197d5c76
commit 224a84d082
2 changed files with 25 additions and 0 deletions

View File

@ -22,6 +22,9 @@ export interface NekoEvents {
['screen.updated']: (width: number, height: number, rate: number) => void ['screen.updated']: (width: number, height: number, rate: number) => void
['clipboard.updated']: (text: string) => void ['clipboard.updated']: (text: string) => void
['broadcast.status']: (isActive: boolean, url: string | undefined) => void ['broadcast.status']: (isActive: boolean, url: string | undefined) => void
['file_chooser_dialog.requested']: () => void
['file_chooser_dialog.overlay']: (id: string) => void
['file_chooser_dialog.closed']: () => void
} }
export class NekoMessages extends EventEmitter<NekoEvents> { export class NekoMessages extends EventEmitter<NekoEvents> {
@ -173,4 +176,23 @@ export class NekoMessages extends EventEmitter<NekoEvents> {
// TODO: Handle. // TODO: Handle.
this.emit('broadcast.status', is_active, url) this.emit('broadcast.status', is_active, url)
} }
/////////////////////////////
// FileChooserDialog Events
/////////////////////////////
protected [EVENT.FILE_CHOOSER_DIALOG_OPENED]({ id }: message.MemberID) {
this._log.debug('EVENT.FILE_CHOOSER_DIALOG_OPENED')
if (id == this.state.member_id) {
this.emit('file_chooser_dialog.requested')
} else {
this.emit('file_chooser_dialog.overlay', id)
}
}
protected [EVENT.FILE_CHOOSER_DIALOG_CLOSED]({ id }: message.MemberID) {
this._log.debug('EVENT.FILE_CHOOSER_DIALOG_CLOSED')
this.emit('file_chooser_dialog.closed')
}
} }

View File

@ -31,3 +31,6 @@ export const KEYBOARD_MAP = 'keyboard/map'
export const CURSOR_IMAGE = 'cursor/image' export const CURSOR_IMAGE = 'cursor/image'
export const BORADCAST_STATUS = 'broadcast/status' export const BORADCAST_STATUS = 'broadcast/status'
export const FILE_CHOOSER_DIALOG_OPENED = 'file_chooser_dialog/opened'
export const FILE_CHOOSER_DIALOG_CLOSED = 'file_chooser_dialog/closed'