docs: add Asynchronous Messages Fiddle example (#20441)
* 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>
This commit is contained in:
parent
ec87917f58
commit
c2e77e4429
3 changed files with 68 additions and 0 deletions
|
@ -0,0 +1,12 @@
|
|||
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
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue