Skip to content

Commit f57320e

Browse files
author
Christopher Willis-Ford
committed
Show splash screen ASAP, load render JS async
1 parent 414a1f0 commit f57320e

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

electron-webpack.json5

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"webpackConfig": "webpack.main.additions.js"
44
},
55
"renderer": {
6+
"template": "src/renderer/index.html",
67
"webpackConfig": "webpack.renderer.additions.js"
78
}
89
}

src/renderer/index.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<style>
6+
.splash {
7+
font-size: xx-large;
8+
margin: 0;
9+
position: absolute;
10+
top: 50%;
11+
left: 50%;
12+
transform: translate(-50%, -50%);
13+
}
14+
</style>
15+
</head>
16+
<body>
17+
<div id="app"><p class="splash">Scratch Desktop is loading...</p></div>
18+
</body>
19+
</html>

src/renderer/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
import './app.jsx';
1+
// this is an async import so that it doesn't block the first render
2+
// index.html contains a loading/splash screen which will display while this import loads
3+
import('./app.jsx');

0 commit comments

Comments
 (0)