Wait for 'ready-to-show' event before showing window (#959)
This gets rid of the light gray to dark gray background color change on the main window at startup. Makes the window show slightly later, but it's gray for less time. Doesn't affect overall startup time. Feels less jank IMO. From the Electron docs: > While loading the page, the 'ready-to-show' event will be emitted when renderer process has done drawing for the first time, showing window after this event will have no visual flash.
This commit is contained in:
parent
5de39bd7e5
commit
6d375d5b5b
2 changed files with 6 additions and 2 deletions
|
|
@ -32,7 +32,7 @@ function init () {
|
|||
// No menu on the About window
|
||||
win.setMenu(null)
|
||||
|
||||
win.webContents.once('did-finish-load', function () {
|
||||
win.once('ready-to-show', function () {
|
||||
win.show()
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -38,13 +38,17 @@ function init (state, options) {
|
|||
title: config.APP_WINDOW_TITLE,
|
||||
titleBarStyle: 'hidden-inset', // Hide title bar (Mac)
|
||||
useContentSize: true, // Specify web page size without OS chrome
|
||||
show: !options.hidden,
|
||||
show: false,
|
||||
width: initialBounds.width,
|
||||
height: initialBounds.height,
|
||||
x: initialBounds.x,
|
||||
y: initialBounds.y
|
||||
})
|
||||
|
||||
win.once('ready-to-show', function () {
|
||||
if (!options.hidden) win.show()
|
||||
})
|
||||
|
||||
win.loadURL(config.WINDOW_MAIN)
|
||||
|
||||
if (win.setSheetOffset) win.setSheetOffset(config.UI_HEADER_HEIGHT)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue