I'm new to Electron, my goal is to run a Django app within. The Django app has been compiled using PyInstaller and placed correctly within my electron project structure.
My problem is that when I start electron (electron .
) its blank window opens. I need to hit refresh to show to right content. I cannot get this to work such that the page is reloaded to show content during electron opening. I tried the reload()
and reloadIgnoringCache()
option but it doesn't help...
Analysing my window webContents
parameters I can see that my window initially gets currentIndex: -1
and after manually reloading currentIndex: 0
(not sure if that is relevant...).
Here is the relevant part of my main.js
file:
app.on('ready', function() {
log.info('App is ready?!....');
var openWindow = function(mainAddr){
mainWindow = new BrowserWindow({width: 1200, height: 800, backgroundColor: '#eeeeee', show:false});
mainWindow.loadURL(mainAddr);
mainWindow.webContents.on('did-finish-load', function() {
mainWindow.show();
});
mainWindow.webContents.session.clearCache(function() {
console.log("Cache has been cleared.");
});
mainWindow.webContents.reloadIgnoringCache();
mainWindow.webContents.openDevTools();
mainWindow.on('closed', function() {
mainWindow = null;
subpy.kill('SIGINT');
});
};
via user1544500
No comments:
Post a Comment