-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Show window after page is ready
zcbenz edited this page Oct 25, 2012
·
1 revision
This example needs node-webkit >= v0.3.0
Normally when node-webkit loads an app, it would: 1. show the browser; 2. unzip your app; 3. create renderer process; 4. initialize WebKit; 5. finally open your app. This progress would take some time, and your user may see the empty browser becoming a full loaded app.
To make your app seem to start smoothly, you should show the main window after everything is ready. There are some tips to achieve this.
First you need to specify "show": false
in the package.json
, so node-webkit will not show the window on startup:
{
"window": {
"show": false
}
}
Then after everything is fully loaded, you can use the Window API to show your app's window:
<script>
var gui = require('nw.gui');
onload = function() {
gui.Window.get().show();
}
</script>