electron/docs/fiddles/native-ui/dialogs/information-dialog/renderer.js

14 lines
453 B
JavaScript

const { ipcRenderer } = require('electron/renderer')
const informationBtn = document.getElementById('information-dialog')
informationBtn.addEventListener('click', event => {
ipcRenderer.send('open-information-dialog')
})
ipcRenderer.on('information-dialog-selection', (event, index) => {
let message = 'You selected '
if (index === 0) message += 'yes.'
else message += 'no.'
document.getElementById('info-selection').innerHTML = message
})