File tree Expand file tree Collapse file tree 1 file changed +19
-14
lines changed Expand file tree Collapse file tree 1 file changed +19
-14
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ const registerMenu = require('./backend/menu.js')
77
88let win = null // main window
99let splash = null
10- let splashTimeout = null
10+ let splashTimestamp = null
1111
1212// START APP
1313function createWindow ( ) {
@@ -25,22 +25,27 @@ function createWindow () {
2525 } )
2626 // and load the index.html of the app.
2727 win . loadFile ( 'ui/arduino/index.html' )
28+
2829 // If the app takes a while to open, show splash screen
29- splashTimeout = setTimeout ( ( ) => {
30- // Create the splash screen
31- splash = new BrowserWindow ( {
32- width : 560 ,
33- height : 180 ,
34- transparent : true ,
35- frame : false ,
36- alwaysOnTop : true
37- } ) ;
38- splash . loadFile ( 'ui/arduino/splash.html' )
39- } , 250 )
30+ // Create the splash screen
31+ splash = new BrowserWindow ( {
32+ width : 450 ,
33+ height : 140 ,
34+ transparent : true ,
35+ frame : false ,
36+ alwaysOnTop : true
37+ } ) ;
38+ splash . loadFile ( 'ui/arduino/splash.html' )
39+ splashTimestamp = Date . now ( )
4040
4141 win . once ( 'ready-to-show' , ( ) => {
42- clearTimeout ( splashTimeout )
43- if ( splash ) splash . destroy ( )
42+ if ( Date . now ( ) - splashTimestamp > 1000 ) {
43+ splash . destroy ( )
44+ } else {
45+ setTimeout ( ( ) => {
46+ splash . destroy ( )
47+ } , 500 )
48+ }
4449 win . show ( )
4550 } )
4651
You can’t perform that action at this time.
0 commit comments