armcord/src/preload/bridge.ts

32 lines
1.3 KiB
TypeScript
Raw Normal View History

import { contextBridge, ipcRenderer } from "electron";
import { getDisplayMediaSelector } from "./capturer";
2021-12-24 21:56:49 +00:00
2021-12-24 21:56:49 +00:00
contextBridge.exposeInMainWorld("armcord", {
window: {
show: () => ipcRenderer.send("win-show"),
hide: () => ipcRenderer.send("win-hide"),
minimize: () => ipcRenderer.send("win-minimize"),
maximize: () => ipcRenderer.send("win-maximize"),
2021-12-24 21:56:49 +00:00
},
electron: process.versions.electron,
channel: ipcRenderer.sendSync('channel'),
version: ipcRenderer.sendSync("get-app-version", "app-version"),
2021-12-24 21:56:49 +00:00
getDisplayMediaSelector: getDisplayMediaSelector,
saveSettings: (...args: any) => ipcRenderer.send("saveSettings", ...args),
splashEnd: () => ipcRenderer.send("splashEnd"),
loadDiscord: () => ipcRenderer.send("loadDiscord"),
});
contextBridge.exposeInMainWorld("electron", {
//deprecated, used for legacy purposes, will be removed in future versions
window: {
show: () => ipcRenderer.send("win-show"),
hide: () => ipcRenderer.send("win-hide"),
minimize: () => ipcRenderer.send("win-minimize"),
maximize: () => ipcRenderer.send("win-maximize"),
},
electron: process.versions.electron,
warning: 'This is a deprecated API and will be removed in future versions (3.0.0 --> 3.1.0).',
version: ipcRenderer.sendSync("get-app-version", "app-version"),
});