-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Hey Johnny --
In using your library, I'm running into an issue in restoring windows where webpreferences like preload scripts and nodeIntegration: false can only be added to the main window, and not windows that aren't considered main.
Is there a recommended way to add preload scripts to all windows, and not just the main window when windows are restored?
I was able to get around this by changing:
if ( state.main ) {
// NOTE: It is possible we change default options during development, so event we restore
// a window, we should always apply default options for the main window.
// clone the opts
let opts2 = Object.assign({}, opts);
opts2.show = false;
win = new BrowserWindow(opts2);
_mainwin = win;
} else {
win = new BrowserWindow({
show: false
});
}
to
if ( state.main ) {
// NOTE: It is possible we change default options during development, so event we restore
// a window, we should always apply default options for the main window.
// clone the opts
win = new BrowserWindow(opts2);
_mainwin = win;
} else {
win = new BrowserWindow(opts2);
}
In a forked repo as a test, but I'd love to hear if there's a better way to do this. Is this a functionality you'd consider adding?
Let me know. Thanks!
Eric
Metadata
Metadata
Assignees
Labels
No labels