1
0
mirror of https://github.com/upscayl/upscayl.git synced 2025-02-15 02:12:34 +01:00
upscayl/electron/preload.ts
2024-12-16 16:18:57 +05:30

22 lines
775 B
TypeScript

import { ipcRenderer, contextBridge, app } from "electron";
import {
getAppVersion,
getDeviceSpecs,
getPlatform,
} from "./utils/get-device-specs";
import { FEATURE_FLAGS } from "@common/feature-flags";
// 'ipcRenderer' will be available in index.js with the method 'window.electron'
contextBridge.exposeInMainWorld("electron", {
send: (command: string, payload: any) => ipcRenderer.send(command, payload),
on: (command: string, func: (...args: any) => any) =>
ipcRenderer.on(command, (event, args) => {
func(event, args);
}),
invoke: (command: string, payload: any) =>
ipcRenderer.invoke(command, payload),
platform: getPlatform(),
getSystemInfo: async () => await getDeviceSpecs(),
getAppVersion: async () => await getAppVersion(),
});