-
Notifications
You must be signed in to change notification settings - Fork 88
isElectronApp is true but ipcRenderer is null #32
Comments
I have the same problem.
|
@hjvanranden what was the issue? Sounds like you investigated already some time to get that up and running. Maybe something that could be contributed back to |
The issue is that when using Angular in Electron (with ngx-electron), I cannot make an IPC call, because ipcRenderer == null (although electronSvc.isElectronApp returns true). |
which version of |
Angular CLI: 7.3.8 |
Try setting
|
That fixes the problem, thank you very much!! |
Thank you fixes the problem for me too! :) |
Fixed for me, would be good to have some documentation on it! thanks @bz-dev |
So I have tried this with electron v12 - I need to do 3 things: |
@venomoustoad I am running into a similar issue with electron v12. The reason is that turning on |
Actually I just solved my issue! By using a conditional to check what page the preload script is running on, I was able to delete the node window properties but only on the child window. Keeping these properties on the parent window is required for icpRenderer to work in that context, but I do not need icpRenderer in the child window. Hope this helps! |
I have actually the same problem, when i set the App.mainWindow = new BrowserWindow({
width: width,
height: height,
show: true,
icon: join(__dirname, '..', electronAppName, 'assets', 'icons', 'icon.png'),
webPreferences: {
contextIsolation: false,
nodeIntegration: true,
backgroundThrottling: false,
preload: join(__dirname, 'main.preload.js'),
},
}); |
Hi,
i packed my angular app to an .exe with electron-packager.
Inside my app I want to use sendSync from the ipcRenderer, but then I get an error because the ipcRenderer is null although isElectronApp is true..
This is my code where the window is created:
`
const { app, BrowserWindow } = require('electron');
const path = require('path');
const url = require('url');
let win;
const createWindow = () => {
win = new BrowserWindow({
width: 800,
height: 600,
icon: path.join(__dirname, 'assets/test.png'),
});
win.setKiosk(true);
win.loadURL(url.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file:',
slashes: true
}));
win.on('closed', () => {
win = null;
});
}
app.on('ready', createWindow);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
if (win === null) {
createWindow();
}
});
`
What I am doing wrong?
The text was updated successfully, but these errors were encountered: