Skip to content

Commit dd24825

Browse files
authored
Merge pull request #152 from tonyito/splash
Added a splash screen for the app
2 parents b9122fe + 7079944 commit dd24825

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

main.js

+22-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
const path = require('path');
2+
//import for spalsh screen dependency
3+
const { initSplashScreen, OfficeTemplate } = require('electron-splashscreen');
4+
//path resolver dependency for splash screen
5+
const { resolve } = require('app-root-path');
6+
27

38
const {
49
app,
@@ -82,7 +87,7 @@ ipcMain.on('update-file', () => {
8287
const createWindow = () => {
8388
// Create the browser window.
8489
// eslint-disable-next-line
85-
const { width, height } = require('electron').screen.getPrimaryDisplay().size;
90+
// const { width, height } = require('electron').screen.getPrimaryDisplay().size;
8691
mainWindow = new BrowserWindow({
8792
width: 1920,
8893
height: 1080,
@@ -98,11 +103,27 @@ const createWindow = () => {
98103
}
99104
});
100105

106+
//splash screen deets
107+
const hideSplashscreen = initSplashScreen({
108+
mainWindow,
109+
icon: resolve('/src/public/icons/png/64x64.png'),
110+
url: OfficeTemplate,
111+
width: 500,
112+
height: 300,
113+
brand: 'OS Labs',
114+
productName: 'ReacType',
115+
logo: resolve('/src/public/icons/png/64x64.png'),
116+
color: '#3BBCAF',
117+
website: 'www.reactype.io',
118+
text: 'Initializing ...'
119+
});
120+
101121
// and load the index.html of the app.
102122
mainWindow.loadURL(`file://${__dirname}/build/index.html`);
103123
// load page once window is loaded
104124
mainWindow.once('ready-to-show', () => {
105125
mainWindow.show();
126+
hideSplashscreen();
106127
});
107128

108129
const template = [

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
"@types/react-redux": "^7.0.8",
119119
"@types/react-syntax-highlighter": "^11.0.4",
120120
"ace-builds": "^1.4.8",
121+
"app-root-path": "^3.0.0",
121122
"autoprefixer": "^9.0.1",
122123
"babel-polyfill": "^6.26.0",
123124
"classnames": "^2.2.6",
@@ -128,6 +129,7 @@
128129
"csstype": "^2.6.9",
129130
"d3": "^5.9.2",
130131
"electron-reload": "^1.4.0",
132+
"electron-splashscreen": "^1.0.0",
131133
"enzyme": "^3.4.1",
132134
"enzyme-adapter-react-16": "^1.2.0",
133135
"konva": "^4.2.0",

0 commit comments

Comments
 (0)