clipboard sync and some minor fixes
This commit is contained in:
@ -165,6 +165,11 @@ export abstract class BaseClient extends EventEmitter<BaseEvents> {
|
||||
this.emit('debug', `peer connection state chagned: ${this._state}`)
|
||||
|
||||
switch (this._state) {
|
||||
case 'checking':
|
||||
if (this._timeout) {
|
||||
clearTimeout(this._timeout)
|
||||
}
|
||||
break
|
||||
case 'connected':
|
||||
this.onConnected()
|
||||
break
|
||||
|
@ -29,6 +29,7 @@ export const EVENT = {
|
||||
RELEASE: 'control/release',
|
||||
REQUEST: 'control/request',
|
||||
REQUESTING: 'control/requesting',
|
||||
CLIPBOARD: 'control/clipboard',
|
||||
GIVE: 'control/give',
|
||||
},
|
||||
CHAT: {
|
||||
@ -64,6 +65,7 @@ export type ControlEvents =
|
||||
| typeof EVENT.CONTROL.RELEASE
|
||||
| typeof EVENT.CONTROL.REQUEST
|
||||
| typeof EVENT.CONTROL.GIVE
|
||||
| typeof EVENT.CONTROL.CLIPBOARD
|
||||
|
||||
export type SystemEvents = typeof EVENT.SYSTEM.DISCONNECT
|
||||
export type IdentityEvents = typeof EVENT.IDENTITY.PROVIDE | typeof EVENT.IDENTITY.DETAILS
|
||||
|
@ -17,6 +17,7 @@ import {
|
||||
EmotePayload,
|
||||
AdminPayload,
|
||||
AdminTargetPayload,
|
||||
ControlClipboardPayload,
|
||||
} from './messages'
|
||||
|
||||
interface NekoEvents extends BaseEvents {}
|
||||
@ -254,6 +255,10 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
|
||||
})
|
||||
}
|
||||
|
||||
protected [EVENT.CONTROL.CLIPBOARD]({ text }: ControlClipboardPayload) {
|
||||
this.$accessor.remote.setClipboard(text)
|
||||
}
|
||||
|
||||
/////////////////////////////
|
||||
// Chat Events
|
||||
/////////////////////////////
|
||||
|
@ -27,6 +27,7 @@ export type WebSocketPayloads =
|
||||
| MemberListPayload
|
||||
| Member
|
||||
| ControlPayload
|
||||
| ControlClipboardPayload
|
||||
| ChatPayload
|
||||
| ChatSendPayload
|
||||
| EmojiSendPayload
|
||||
@ -110,6 +111,10 @@ export interface ControlTargetPayload {
|
||||
target: string
|
||||
}
|
||||
|
||||
export interface ControlClipboardPayload {
|
||||
text: string
|
||||
}
|
||||
|
||||
/*
|
||||
CHAT PAYLOADS
|
||||
*/
|
||||
|
Reference in New Issue
Block a user