Merge pull request #141 from resin-io/fix/122/flash-of-white

Fix flash of white at startup
This commit is contained in:
Juan Cruz Viotti 2016-02-04 16:53:39 -04:00
commit d1844b3830

View File

@ -37,12 +37,25 @@ electron.app.on('ready', function() {
mainWindow = new electron.BrowserWindow({
width: 800,
height: 380,
show: false,
resizable: false,
fullscreen: false,
titleBarStyle: 'hidden-inset',
icon: path.join(__dirname, '..', 'assets', 'icon.png')
});
// Prevent flash of white when starting the application
// https://github.com/atom/electron/issues/2172
mainWindow.webContents.on('did-finish-load', function() {
// The flash of white is still present for a very short
// while after the WebView reports it finished loading
setTimeout(function() {
mainWindow.show();
}, 100);
});
mainWindow.on('closed', function() {
mainWindow = null;
});