Skip to content

Commit 85d95f1

Browse files
authored
Merge pull request #16 from el3um4s/add-splashscreen
Add splashscreen
2 parents 09595d8 + 275715c commit 85d95f1

File tree

5 files changed

+41
-23
lines changed

5 files changed

+41
-23
lines changed

electron/mainWindow.ts

+20-20
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,25 @@ class Main {
3838
this.configDev = new ConfigureDev(this.settingsDev);
3939

4040
app.on("ready", async () => {
41-
// let loading = new BrowserWindow({
42-
// show: false,
43-
// frame: false,
44-
// width: 300,
45-
// height: 300,
46-
// transparent: true,
47-
// });
48-
49-
this.window = await this.createWindow();
50-
this.onEvent.emit("window-created");
51-
52-
// loading.once("show", async () => {
53-
// this.window = await this.createWindow();
54-
// this.onEvent.emit("window-created");
55-
// loading.hide();
56-
// loading.close();
57-
// });
58-
// loading.loadURL(path.join(__dirname, "www", "loading.html"));
59-
// loading.show();
41+
let loading = new BrowserWindow({
42+
show: false,
43+
frame: false,
44+
width: 300,
45+
height: 300,
46+
transparent: true,
47+
});
48+
49+
// this.window = await this.createWindow();
50+
// this.onEvent.emit("window-created");
51+
52+
loading.once("show", async () => {
53+
this.window = await this.createWindow();
54+
this.onEvent.emit("window-created");
55+
loading.hide();
56+
loading.close();
57+
});
58+
loading.loadURL(path.join(__dirname, "www", "loading.html"));
59+
loading.show();
6060
});
6161

6262
app.on("window-all-closed", this.onWindowAllClosed);
@@ -81,7 +81,7 @@ class Main {
8181
try {
8282
await window.loadURL("http://localhost:5173/");
8383
} catch (error) {
84-
console.log(`ERROR: window.loadURL("http://localhost:3000/");`);
84+
console.log(`ERROR: window.loadURL("http://localhost:5173/");`);
8585
console.log(error);
8686
}
8787
} else if (this.configDev.isElectronServe()) {

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Memento: how to use Svelte with Electron and TypeScript",
55
"author": "Samuele de Tomasi <[email protected]>",
66
"license": "MIT",
7-
"version": "0.2.0",
7+
"version": "0.2.1",
88
"main": "dist/index.js",
99
"scripts": {
1010
"nodemon": "nodemon",

svelte/static/loading.html

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'">
8+
<meta http-equiv="X-Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'">
9+
<title>Loading</title>
10+
</head>
11+
<body>
12+
<div style="width:100%; text-align: center;">
13+
<div style="width: 256px; height: 256px; border-radius: 100%; background-color: rgb(240,240,240);">
14+
<img width="256px" src="loading.png"/>
15+
</div>
16+
</div>
17+
</body>
18+
</html>

svelte/static/loading.png

13.7 KB
Loading

0 commit comments

Comments
 (0)