Archived
2
0

manual refresh function

This commit is contained in:
William Harrell
2022-11-03 21:54:05 -04:00
parent 70e84c5840
commit cfc7b15211
9 changed files with 74 additions and 4 deletions

View File

@ -134,7 +134,7 @@
}
refresh() {
console.log('refresh')
this.$accessor.files.refresh()
}
download(item: any) {

View File

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

View File

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

View File

@ -30,6 +30,13 @@ export const actions = actionTree(
setFileList(store, files: FileListItem[]) {
accessor.files._setFileList(files)
},
refresh(store) {
if (!accessor.connected) {
return
}
$client.refreshFiles()
}
}
)