mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
add control lock.
This commit is contained in:
@ -1,14 +1,34 @@
|
||||
import Vue from 'vue'
|
||||
|
||||
import * as EVENT from '../types/events'
|
||||
import * as message from '../types/messages'
|
||||
|
||||
import { NekoConnection } from './connection'
|
||||
import { Control } from '../types/state'
|
||||
|
||||
export class NekoControl {
|
||||
// eslint-disable-next-line
|
||||
constructor(
|
||||
private readonly _connection: NekoConnection,
|
||||
private readonly _state: Control,
|
||||
) {}
|
||||
|
||||
public lock() {
|
||||
Vue.set(this._state, 'locked', true)
|
||||
}
|
||||
|
||||
public unlock() {
|
||||
Vue.set(this._state, 'locked', false)
|
||||
}
|
||||
|
||||
public request() {
|
||||
this._connection.websocket.send(EVENT.CONTROL_REQUEST)
|
||||
}
|
||||
|
||||
public release() {
|
||||
this._connection.websocket.send(EVENT.CONTROL_RELEASE)
|
||||
}
|
||||
|
||||
public keypress(keysym: number) {
|
||||
this._connection.websocket.send(EVENT.CONTROL_KEYPRESS, { keysym } as message.ControlKey)
|
||||
}
|
||||
|
Reference in New Issue
Block a user