New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "ready-to-show" event and docs on showing window gracefully #6026

Merged
merged 4 commits into from Jun 13, 2016

Conversation

Projects
None yet
3 participants
@zcbenz
Contributor

zcbenz commented Jun 13, 2016

This PR adds a way to avoid the flash of background color when showing window:

let win = new BrowserWindow({show: false})
win.on('ready-to-show', () => {
  win.show()
})

Internally it is done by resizing the RenderWidget to force drawing before window is displayed.

@zcbenz zcbenz merged commit fcc7dc7 into master Jun 13, 2016

9 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
electron-linux-arm Build #3421609 succeeded in 46s
Details
electron-linux-ia32 Build #3421610 succeeded in 36s
Details
electron-linux-x64 Build #3421611 succeeded in 122s
Details
electron-mas-x64 Build #1516 succeeded in 6 min 14 sec
Details
electron-osx-x64 Build #1521 succeeded in 6 min 47 sec
Details
electron-win-ia32 Build #518 succeeded in 6 min 25 sec
Details
electron-win-x64 Build #511 succeeded in 6 min 12 sec
Details

@zcbenz zcbenz deleted the ready-to-show branch Jun 13, 2016

@kunkinkan

This comment has been minimized.

kunkinkan commented Jun 16, 2016

Does this work on webviews too?

@bpasero

This comment has been minimized.

Contributor

bpasero commented Jul 1, 2016

@zcbenz if I set the background color of the browser window early enough to a dark color, I can also prevent the white flash as far as I know. So how is this event helping over the solution of setting background color?

@zcbenz

This comment has been minimized.

Contributor

zcbenz commented Jul 1, 2016

@bpasero This event is emitted after the window has drawn the page for the first time, so ideally users won't see your page being constructed.

@bpasero

This comment has been minimized.

Contributor

bpasero commented Jul 1, 2016

@zcbenz so you say, even if I set a background color, there is still a chance of seeing the page turning from white to the color if I am not using this event?

@zcbenz

This comment has been minimized.

Contributor

zcbenz commented Jul 1, 2016

@bpasero No, users will only see DOM elements being constructed upon the background color, there is no white flash.

@bpasero

This comment has been minimized.

Contributor

bpasero commented Jul 1, 2016

Ok thanks, got it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment