Archived
2
0

clipboard sync and some minor fixes

This commit is contained in:
Craig
2020-01-25 14:29:52 +00:00
parent e3a73aa264
commit 56a5dcf77f
22 changed files with 359 additions and 88 deletions

View File

@ -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

View File

@ -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

View File

@ -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
/////////////////////////////

View File

@ -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
*/