mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
manual refresh function
This commit is contained in:
@ -134,7 +134,7 @@
|
||||
}
|
||||
|
||||
refresh() {
|
||||
console.log('refresh')
|
||||
this.$accessor.files.refresh()
|
||||
}
|
||||
|
||||
download(item: any) {
|
||||
|
@ -187,6 +187,14 @@ export abstract class BaseClient extends EventEmitter<BaseEvents> {
|
||||
this._ws!.send(JSON.stringify({ event, ...payload }))
|
||||
}
|
||||
|
||||
public refreshFiles() {
|
||||
if (!this.connected) {
|
||||
this.emit('warn', 'attempting to refresh files while disconnected')
|
||||
}
|
||||
this.emit('debug', `sending event '${EVENT.FILETRANSFER.REFRESH}'`)
|
||||
this._ws!.send(JSON.stringify({ event: EVENT.FILETRANSFER.REFRESH }))
|
||||
}
|
||||
|
||||
public async createPeer(lite: boolean, servers: RTCIceServer[]) {
|
||||
this.emit('debug', `creating peer`)
|
||||
if (!this.socketOpen) {
|
||||
|
@ -43,7 +43,8 @@ export const EVENT = {
|
||||
DISABLE: 'filetransfer/disable',
|
||||
UNPRIVENABLE: 'filetransfer/unprivenable',
|
||||
UNPRIVDISABLE: 'filetransfer/unprivdisable',
|
||||
LIST: 'filetransfer/list'
|
||||
LIST: 'filetransfer/list',
|
||||
REFRESH: 'filetransfer/refresh'
|
||||
},
|
||||
SCREEN: {
|
||||
CONFIGURATIONS: 'screen/configurations',
|
||||
@ -106,6 +107,7 @@ export type FileTransferEvents =
|
||||
| typeof EVENT.FILETRANSFER.UNPRIVENABLE
|
||||
| typeof EVENT.FILETRANSFER.UNPRIVDISABLE
|
||||
| typeof EVENT.FILETRANSFER.LIST
|
||||
| typeof EVENT.FILETRANSFER.REFRESH
|
||||
|
||||
export type ScreenEvents = typeof EVENT.SCREEN.CONFIGURATIONS | typeof EVENT.SCREEN.RESOLUTION | typeof EVENT.SCREEN.SET
|
||||
|
||||
|
@ -30,6 +30,13 @@ export const actions = actionTree(
|
||||
|
||||
setFileList(store, files: FileListItem[]) {
|
||||
accessor.files._setFileList(files)
|
||||
},
|
||||
|
||||
refresh(store) {
|
||||
if (!accessor.connected) {
|
||||
return
|
||||
}
|
||||
$client.refreshFiles()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
Reference in New Issue
Block a user