1
0
mirror of https://github.com/upscayl/upscayl.git synced 2025-02-15 10:22:37 +01:00
upscayl/electron/preload.ts

22 lines
775 B
TypeScript
Raw Normal View History

2024-12-16 16:18:57 +05:30
import { ipcRenderer, contextBridge, app } from "electron";
import {
getAppVersion,
getDeviceSpecs,
getPlatform,
} from "./utils/get-device-specs";
import { FEATURE_FLAGS } from "@common/feature-flags";
2022-08-15 10:23:14 +05:30
2022-08-15 12:36:31 +05:30
// 'ipcRenderer' will be available in index.js with the method 'window.electron'
2022-08-17 08:07:50 +05:30
contextBridge.exposeInMainWorld("electron", {
2022-11-12 02:17:00 +05:30
send: (command: string, payload: any) => ipcRenderer.send(command, payload),
on: (command: string, func: (...args: any) => any) =>
2022-08-17 08:07:50 +05:30
ipcRenderer.on(command, (event, args) => {
2022-08-17 17:06:19 +05:30
func(event, args);
2022-08-17 08:07:50 +05:30
}),
2022-11-12 02:17:00 +05:30
invoke: (command: string, payload: any) =>
ipcRenderer.invoke(command, payload),
2023-08-30 10:24:16 +05:30
platform: getPlatform(),
2024-12-16 16:18:57 +05:30
getSystemInfo: async () => await getDeviceSpecs(),
getAppVersion: async () => await getAppVersion(),
2022-08-17 08:07:50 +05:30
});