c2e77e4429
* docs: add Asynchronous Messages Fiddle example * Update docs/fiddles/communication/two-processes/asynchronous-messages/main.js Co-Authored-By: John Kleinschmidt <jkleinsc@github.com> * Update docs/fiddles/communication/two-processes/asynchronous-messages/index.html Co-Authored-By: John Kleinschmidt <jkleinsc@github.com>
12 lines
378 B
JavaScript
12 lines
378 B
JavaScript
const { ipcRenderer } = require('electron')
|
|
|
|
const asyncMsgBtn = document.getElementById('async-msg')
|
|
|
|
asyncMsgBtn.addEventListener('click', () => {
|
|
ipcRenderer.send('asynchronous-message', 'ping')
|
|
})
|
|
|
|
ipcRenderer.on('asynchronous-reply', (event, arg) => {
|
|
const message = `Asynchronous message reply: ${arg}`
|
|
document.getElementById('async-reply').innerHTML = message
|
|
})
|