-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreload.js
More file actions
21 lines (20 loc) · 805 Bytes
/
preload.js
File metadata and controls
21 lines (20 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const {
contextBridge,
ipcRenderer
} = require('electron');
// Expose Methods to Renderers
contextBridge.exposeInMainWorld( "Controller", {
// From HTML to Main Process - Wait for a Response.
Call: function( callChannel, callParams ){
console.log( `PreLoad - ContextBridge - Controller - Call - ` + callChannel );
console.log( callParams );
return ipcRenderer.invoke( callChannel, callParams );
},
// From HTML to Main Process - Don't wait for a Response.
Transmit: function( transChannel, transParams ){
console.log( `PreLoad - ContextBridge - Controller - Transmit - ` + transChannel );
console.log( transParams );
ipcRenderer.send( transChannel, transParams );
}
}
);