Electron's IPC not sending/receiving

Having problems sending and receiving data via Electron’s IPC module? This might be the culprit. To use IPC, you need to make sure that your listener window did-finish-load. Otherwise, your data will just fade into the ether.

// Main
yourWindow.webContents.on('did-finish-load', () => {
yourWindow.webContents.send('testChannel', 'Hello world!')
})
// Renderer
ipcRenderer.on('testChannel', (event, data) => {
console.log(data)
})

About the author

I'm Mark Thomas Miller, a full stack engineer and designer currently working at ConvertKit. (We're hiring!) People like Arnold Schwarzenegger, Lindsey Stirling, and Tim Ferriss use features I've built to connect with their fans. I'm currently geeking out about Svelte, mechanical keyboards, and minimalist UI design, and replaying Ocarina of Time.