diff --git a/imagelab_react/public/electron.js b/imagelab_react/public/electron.js index 1031e67..785c999 100644 --- a/imagelab_react/public/electron.js +++ b/imagelab_react/public/electron.js @@ -13,6 +13,7 @@ function createWindow() { webPreferences: { nodeIntegration: true, contextIsolation: false, + preload: path.join(__dirname, 'preload.js'), }, }); diff --git a/imagelab_react/public/preload.js b/imagelab_react/public/preload.js new file mode 100644 index 0000000..983dd63 --- /dev/null +++ b/imagelab_react/public/preload.js @@ -0,0 +1,2 @@ +const electron = require('electron'); +window.ipcRenderer = electron.ipcRenderer; diff --git a/imagelab_react/src/browse-blocks-functions.js b/imagelab_react/src/browse-blocks-functions.js index a66a855..6feb2df 100644 --- a/imagelab_react/src/browse-blocks-functions.js +++ b/imagelab_react/src/browse-blocks-functions.js @@ -1,6 +1,5 @@ import Blockly from "blockly"; -const electron = window.require('electron'); -const ipcRenderer = electron.ipcRenderer; +const ipcRenderer = window.ipcRenderer; /*This function is responible for opening file selector window to choose the picture you will do operqations on it works with (read image) block */ diff --git a/imagelab_react/src/utils/main.js b/imagelab_react/src/utils/main.js index 20aa6da..df346c0 100644 --- a/imagelab_react/src/utils/main.js +++ b/imagelab_react/src/utils/main.js @@ -1,6 +1,5 @@ import Blockly from "blockly"; -const electron = window.require('electron'); -const ipcRenderer = electron.ipcRenderer; +const ipcRenderer = window.ipcRenderer; function processBlock(block, pipeline) { const blockParams = block.inputList.reduce((params, input) => {