Created
October 8, 2020 15:52
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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