File tree 1 file changed +19
-14
lines changed
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')
7
7
8
8
let win = null // main window
9
9
let splash = null
10
- let splashTimeout = null
10
+ let splashTimestamp = null
11
11
12
12
// START APP
13
13
function createWindow ( ) {
@@ -25,22 +25,27 @@ function createWindow () {
25
25
} )
26
26
// and load the index.html of the app.
27
27
win . loadFile ( 'ui/arduino/index.html' )
28
+
28
29
// 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 ( )
40
40
41
41
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
+ }
44
49
win . show ( )
45
50
} )
46
51
You can’t perform that action at this time.
0 commit comments