mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
move control events to own emitter.
This commit is contained in:
parent
87766d4e41
commit
7d779396ba
@ -3,15 +3,23 @@ import Vue from 'vue'
|
|||||||
import * as EVENT from '../types/events'
|
import * as EVENT from '../types/events'
|
||||||
import * as message from '../types/messages'
|
import * as message from '../types/messages'
|
||||||
|
|
||||||
|
import EventEmitter from 'eventemitter3'
|
||||||
import { NekoConnection } from './connection'
|
import { NekoConnection } from './connection'
|
||||||
import { Control } from '../types/state'
|
import { Control } from '../types/state'
|
||||||
|
|
||||||
export class NekoControl {
|
export interface NekoControlEvents {
|
||||||
|
['overlay.click']: () => void
|
||||||
|
['overlay.contextmenu']: () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
export class NekoControl extends EventEmitter<NekoControlEvents> {
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _connection: NekoConnection,
|
private readonly _connection: NekoConnection,
|
||||||
private readonly _state: Control,
|
private readonly _state: Control,
|
||||||
) {}
|
) {
|
||||||
|
super()
|
||||||
|
}
|
||||||
|
|
||||||
public lock() {
|
public lock() {
|
||||||
Vue.set(this._state, 'locked', true)
|
Vue.set(this._state, 'locked', true)
|
||||||
|
@ -39,10 +39,6 @@ export interface NekoEvents {
|
|||||||
['room.screen.updated']: (width: number, height: number, rate: number) => void
|
['room.screen.updated']: (width: number, height: number, rate: number) => void
|
||||||
['room.clipboard.updated']: (text: string) => void
|
['room.clipboard.updated']: (text: string) => void
|
||||||
['room.broadcast.status']: (isActive: boolean, url?: string) => void
|
['room.broadcast.status']: (isActive: boolean, url?: string) => void
|
||||||
|
|
||||||
// overlay events
|
|
||||||
['overlay.click']: () => void
|
|
||||||
['overlay.contextmenu']: () => void
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class NekoMessages extends EventEmitter<NekoEvents> {
|
export class NekoMessages extends EventEmitter<NekoEvents> {
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
@implicitControlRelease="control.release()"
|
@implicitControlRelease="control.release()"
|
||||||
@updateKeyboardModifiers="updateKeyboardModifiers($event)"
|
@updateKeyboardModifiers="updateKeyboardModifiers($event)"
|
||||||
@uploadDrop="uploadDrop($event)"
|
@uploadDrop="uploadDrop($event)"
|
||||||
@onAction="events.emit('overlay.' + $event)"
|
@onAction="control.emit('overlay.' + $event)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user