electron/docs/fiddles/ipc/pattern-3/renderer.js

9 lines
270 B
JavaScript

const counter = document.getElementById('counter')
window.electronAPI.onUpdateCounter((value) => {
const oldValue = Number(counter.innerText)
const newValue = oldValue + value
counter.innerText = newValue.toString()
window.electronAPI.counterValue(newValue)
})