Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Image Lab React]:Added preload scripts to use ipcRenderer. #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions imagelab_react/public/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function createWindow() {
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
preload: path.join(__dirname, 'preload.js'),
},
});

Expand Down
2 changes: 2 additions & 0 deletions imagelab_react/public/preload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const electron = require('electron');
window.ipcRenderer = electron.ipcRenderer;
3 changes: 1 addition & 2 deletions imagelab_react/src/browse-blocks-functions.js
Original file line number Diff line number Diff line change
@@ -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 */
Expand Down
3 changes: 1 addition & 2 deletions imagelab_react/src/utils/main.js
Original file line number Diff line number Diff line change
@@ -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) => {
Expand Down