Skip to content

Commit 2b36cfa

Browse files
committed
Always show the splash screen for a brief time
1 parent 4aadc29 commit 2b36cfa

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

index.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const registerMenu = require('./backend/menu.js')
77

88
let win = null // main window
99
let splash = null
10-
let splashTimeout = null
10+
let splashTimestamp = null
1111

1212
// START APP
1313
function 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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy