[Distribution] Addition of console window
This commit is contained in:
1 parent
d10fbc656f
commit
f2b273e583
3 files changed
+246
-16
No files matched your search
+25
@@ -0,0 +1,25 @@
|
||||
const {
|
||||
contextBridge,
|
||||
ipcRenderer
|
||||
} = require("electron");
|
||||
|
||||
// Expose protected methods that allow the renderer process to use
|
||||
// the ipcRenderer without exposing the entire object
|
||||
contextBridge.exposeInMainWorld(
|
||||
"api", {
|
||||
send: (channel, data) => {
|
||||
// whitelist channels
|
||||
let validChannels = ["toMain"];
|
||||
if (validChannels.includes(channel)) {
|
||||
ipcRenderer.send(channel, data);
|
||||
}
|
||||
},
|
||||
receive: (channel, func) => {
|
||||
let validChannels = ["fromMain"];
|
||||
if (validChannels.includes(channel)) {
|
||||
// Deliberately strip event as it includes `sender`
|
||||
ipcRenderer.on(channel, (event, ...args) => func(...args));
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
Reference in new issue
Block a user