aboutsummaryrefslogtreecommitdiff
path: root/src/VencordNative.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/VencordNative.ts')
-rw-r--r--src/VencordNative.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/VencordNative.ts b/src/VencordNative.ts
index ed0686d..da09ade 100644
--- a/src/VencordNative.ts
+++ b/src/VencordNative.ts
@@ -19,6 +19,7 @@
import { IpcEvents } from "@utils/IpcEvents";
import { IpcRes } from "@utils/types";
import { ipcRenderer } from "electron";
+import type { UserThemeHeader } from "main/themes";
function invoke<T = any>(event: IpcEvents, ...args: any[]) {
return ipcRenderer.invoke(event, ...args) as Promise<T>;
@@ -29,6 +30,14 @@ export function sendSync<T = any>(event: IpcEvents, ...args: any[]) {
}
export default {
+ themes: {
+ uploadTheme: (fileName: string, fileData: string) => invoke<void>(IpcEvents.UPLOAD_THEME, fileName, fileData),
+ deleteTheme: (fileName: string) => invoke<void>(IpcEvents.DELETE_THEME, fileName),
+ getThemesDir: () => invoke<string>(IpcEvents.GET_THEMES_DIR),
+ getThemesList: () => invoke<Array<UserThemeHeader>>(IpcEvents.GET_THEMES_LIST),
+ getThemeData: (fileName: string) => invoke<string | undefined>(IpcEvents.GET_THEME_DATA, fileName)
+ },
+
updater: {
getUpdates: () => invoke<IpcRes<Record<"hash" | "author" | "message", string>[]>>(IpcEvents.GET_UPDATES),
update: () => invoke<IpcRes<boolean>>(IpcEvents.UPDATE),
@@ -50,6 +59,10 @@ export default {
ipcRenderer.on(IpcEvents.QUICK_CSS_UPDATE, (_, css) => cb(css));
},
+ addThemeChangeListener(cb: () => void) {
+ ipcRenderer.on(IpcEvents.THEME_UPDATE, cb);
+ },
+
openFile: () => invoke<void>(IpcEvents.OPEN_QUICKCSS),
openEditor: () => invoke<void>(IpcEvents.OPEN_MONACO_EDITOR),
},