-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrenderer.js
More file actions
22 lines (19 loc) · 716 Bytes
/
renderer.js
File metadata and controls
22 lines (19 loc) · 716 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const { ipcRenderer } = require('electron')
// GOOD
document.getElementById('ping-good').onclick = () => {
// Send a IPC async message to electron
// See main.js on line 31
ipcRenderer.send('ping-good', 'ping')
document.getElementById('ping-good-response').innerText = 'Waiting..'
}
// Receive reply from elecron
// See file main.js on line 37
ipcRenderer.on('ping-good-reply', (event, response) => {
document.getElementById('ping-good-response').innerText = response
})
// BAD
document.getElementById('ping-bad').onclick = () => {
// Send a IPC sync message to electron
// See main.js on line 42
document.getElementById('ping-bad-response').innerText = ipcRenderer.sendSync('ping-bad', 'ping')
}