electron/docs/fiddles/communication/two-processes/synchronous-messages/renderer.js
Amarnath Karthi 0fe718b1d9 docs: add Synchronous Messages Fiddle example (#20451)
* docs: add Synchronous Messages Fiddle example

* Code review changes

* Add OS support info
2019-11-01 14:02:42 -04:00

9 lines
No EOL
338 B
JavaScript

const { ipcRenderer } = require('electron')
const syncMsgBtn = document.getElementById('sync-msg')
syncMsgBtn.addEventListener('click', () => {
const reply = ipcRenderer.sendSync('synchronous-message', 'ping')
const message = `Synchronous message reply: ${reply}`
document.getElementById('sync-reply').innerHTML = message
})