-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathpreload.js
More file actions
49 lines (48 loc) · 1.42 KB
/
Copy pathpreload.js
File metadata and controls
49 lines (48 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// ESM support in preload is not quite mature, so we use CommonJS `require` here
const { contextBridge, ipcRenderer } = require("electron");
contextBridge.exposeInMainWorld("transitio", {
rendererReady: () => ipcRenderer.send(
"PRO-2684.transitio.rendererReady"
),
configChange: (path, arg) => ipcRenderer.send(
"PRO-2684.transitio.configChange",
path, arg
),
devMode: (enable) => ipcRenderer.send(
"PRO-2684.transitio.devMode",
enable
),
reloadStyle: () => ipcRenderer.send(
"PRO-2684.transitio.reloadStyle"
),
importStyle: (fname, content) => ipcRenderer.send(
"PRO-2684.transitio.importStyle",
fname, content
),
removeStyle: (path) => ipcRenderer.send(
"PRO-2684.transitio.removeStyle",
path
),
resetStyle: (path) => ipcRenderer.send(
"PRO-2684.transitio.resetStyle",
path
),
open: (type, uri) => ipcRenderer.send(
"PRO-2684.transitio.open",
type, uri
),
queryIsDebug: () => ipcRenderer.invoke(
"PRO-2684.transitio.queryIsDebug"
),
queryDevMode: () => ipcRenderer.invoke(
"PRO-2684.transitio.queryDevMode"
),
onUpdateStyle: (callback) => ipcRenderer.on(
"PRO-2684.transitio.updateStyle",
callback
),
onResetStyle: (callback) => ipcRenderer.on(
"PRO-2684.transitio.resetStyle",
callback
),
});