Added handlers for ipc.

This commit is contained in:
Patrick Fic
2020-10-13 10:57:20 -07:00
parent 0715b20e4c
commit 36b3719df0
5 changed files with 39 additions and 7 deletions

10
electron/ipc-handler.js Normal file
View File

@@ -0,0 +1,10 @@
const electron = require("electron");
const { ipcMain } = electron;
console.log("*** Added IPC Handlers ***");
ipcMain.on("test-start", (event, arg) => {
console.log("Test Start Inbound.", arg);
event.sender.send("test-success", { success: true });
});

View File

@@ -1,11 +1,10 @@
const path = require("path");
require("./ipc-handler");
const { app, BrowserWindow } = require("electron");
const isDev = require("electron-is-dev");
// Conditionally include the dev tools installer to load React Dev Tools
let installExtension, REACT_DEVELOPER_TOOLS; // NEW!
if (isDev) {
const devTools = require("electron-devtools-installer");
installExtension = devTools.default;
@@ -45,7 +44,7 @@ function createWindow() {
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(() => {
console.log("Ready to launch the app!");
console.log("*** Ready to launch the app! ***");
createWindow();
if (isDev) {