mirror of https://github.com/Fabio286/antares.git
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { ShortcutRecord } from 'common/shortcuts';
|
|
import { ipcRenderer, OpenDialogOptions, OpenDialogReturnValue } from 'electron';
|
|
|
|
import { unproxify } from '../libs/unproxify';
|
|
|
|
export default class {
|
|
static showOpenDialog (options: OpenDialogOptions): Promise<OpenDialogReturnValue> {
|
|
return ipcRenderer.invoke('show-open-dialog', unproxify(options));
|
|
}
|
|
|
|
static showSaveDialog (options: OpenDialogOptions): Promise<OpenDialogReturnValue> {
|
|
return ipcRenderer.invoke('show-save-dialog', unproxify(options));
|
|
}
|
|
|
|
static getDownloadPathDirectory (): Promise<string> {
|
|
return ipcRenderer.invoke('get-download-dir-path');
|
|
}
|
|
|
|
static reloadShortcuts () {
|
|
return ipcRenderer.invoke('reload-shortcuts');
|
|
}
|
|
|
|
static updateShortcuts (shortcuts: ShortcutRecord[]) {
|
|
return ipcRenderer.invoke('update-shortcuts', unproxify(shortcuts));
|
|
}
|
|
|
|
static restoreDefaultShortcuts () {
|
|
return ipcRenderer.invoke('resotre-default-shortcuts');
|
|
}
|
|
|
|
static unregisterShortcuts () {
|
|
return ipcRenderer.invoke('unregister-shortcuts');
|
|
}
|
|
|
|
static readFile (path: string): Promise<string> {
|
|
return ipcRenderer.invoke('read-file', path);
|
|
}
|
|
|
|
static writeFile (path: string, content: unknown) {
|
|
return ipcRenderer.invoke('write-file', path, content);
|
|
}
|
|
}
|