Turn IpcEvents into a const enum

This commit is contained in:
Vendicated
2023-04-09 01:22:31 +02:00
parent 8f19d41d4c
commit 591d380160
4 changed files with 30 additions and 27 deletions
+6 -6
View File
@@ -1,21 +1,21 @@
import { app, ipcRenderer } from "electron";
import type { Settings } from "../main/settings";
import { FOCUS, GET_SETTINGS, RELAUNCH, SET_SETTINGS, SHOW_ITEM_IN_FOLDER } from "../shared/IpcEvents";
import { IpcEvents } from "../shared/IpcEvents";
export const VencordDesktopNative = {
app: {
relaunch: () => ipcRenderer.invoke(RELAUNCH),
relaunch: () => ipcRenderer.invoke(IpcEvents.RELAUNCH),
getVersion: () => app.getVersion()
},
fileManager: {
showItemInFolder: (path: string) => ipcRenderer.invoke(SHOW_ITEM_IN_FOLDER, path)
showItemInFolder: (path: string) => ipcRenderer.invoke(IpcEvents.SHOW_ITEM_IN_FOLDER, path)
},
settings: {
get: () => ipcRenderer.sendSync(GET_SETTINGS),
set: (settings: typeof Settings) => ipcRenderer.invoke(SET_SETTINGS, settings)
get: () => ipcRenderer.sendSync(IpcEvents.GET_SETTINGS),
set: (settings: typeof Settings) => ipcRenderer.invoke(IpcEvents.SET_SETTINGS, settings)
},
win: {
focus: () => ipcRenderer.invoke(FOCUS)
focus: () => ipcRenderer.invoke(IpcEvents.FOCUS)
}
}