-
Notifications
You must be signed in to change notification settings - Fork 5
/
preload.js
45 lines (44 loc) · 1.28 KB
/
preload.js
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
const { contextBridge, ipcRenderer } = require("electron");
contextBridge.exposeInMainWorld("scriptio_internal", {
rendererReady: () => ipcRenderer.send(
"LiteLoader.scriptio.rendererReady"
),
configChange: (path, enable) => ipcRenderer.send(
"LiteLoader.scriptio.configChange",
path, enable
),
devMode: (enable) => ipcRenderer.send(
"LiteLoader.scriptio.devMode",
enable
),
reload: () => ipcRenderer.send(
"LiteLoader.scriptio.reload"
),
importScript: (fname, content) => ipcRenderer.send(
"LiteLoader.scriptio.importScript",
fname, content
),
removeScript: (path) => ipcRenderer.send(
"LiteLoader.scriptio.removeScript",
path
),
open: (type, uri) => ipcRenderer.send(
"LiteLoader.scriptio.open",
type, uri
),
queryIsDebug: () => ipcRenderer.invoke(
"LiteLoader.scriptio.queryIsDebug"
),
queryDevMode: () => ipcRenderer.invoke(
"LiteLoader.scriptio.queryDevMode"
),
fetchText: (...args) => ipcRenderer.invoke(
"LiteLoader.scriptio.fetchText",
...args
),
onUpdateScript: (callback) => ipcRenderer.on(
"LiteLoader.scriptio.updateScript",
callback
),
ipcRenderer: ipcRenderer
});