Skip to content

Instantly share code, notes, and snippets.

@adityapatnaik
Created October 8, 2020 15:52
Show Gist options
  • Save adityapatnaik/d76a75c1bb9f4de841a9e042bbae1f7d to your computer and use it in GitHub Desktop.
Save adityapatnaik/d76a75c1bb9f4de841a9e042bbae1f7d to your computer and use it in GitHub Desktop.
Let's see the IPC in action with a React component:main.js
//write this below the app.whenReady() function in the main.js file
ipcMain.on('anything-asynchronous', (event, arg) => {
// gets triggered by the async button defined in the App component
console.log("async",arg) // prints "async ping"
})
// gets triggered by the sync button defined in the App component
ipcMain.on('anything-synchronous', (event, arg) => {
console.log("sync",arg) // prints "sync ping"
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment