-
Notifications
You must be signed in to change notification settings - Fork 0
/
preload.js
18 lines (17 loc) · 916 Bytes
/
preload.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const { contextBridge, ipcRenderer } = require("electron/renderer");
contextBridge.exposeInMainWorld("electronAPI", {
connectToTv: (ip) => ipcRenderer.invoke("connectToTv", ip),
handleAction: (action) => ipcRenderer.send("handleAction", action),
onGetVolume: (callback) =>
ipcRenderer.on("get-volume", (_event, value) => callback(value)),
onGetLaunchPoints: (callback) =>
ipcRenderer.on("get-launch-points", (_event, value) => callback(value)),
onGetInputList: (callback) =>
ipcRenderer.on("get-input-list", (_event, value) => callback(value)),
onGetForegroundAppId: (callback) =>
ipcRenderer.on("get-foreground-app-id", (_event, value) => callback(value)),
onGetAudioStatus: (callback) =>
ipcRenderer.on("get-audio-status", (_event, value) => callback(value)),
onConnectionSuccess: (callback) =>
ipcRenderer.on("connection-success", (_event, value) => callback(value)),
});