diff --git a/index.js b/index.js index 3f01633..b38f989 100644 --- a/index.js +++ b/index.js @@ -6,6 +6,8 @@ const registerIPCHandlers = require('./backend/ipc.js') const registerMenu = require('./backend/menu.js') let win = null // main window +let splash = null +let splashTimestamp = null // START APP function createWindow () { @@ -17,23 +19,42 @@ function createWindow () { nodeIntegration: false, webSecurity: true, enableRemoteModule: false, - preload: path.join(__dirname, "preload.js") + preload: path.join(__dirname, "preload.js"), + show: false } }) // and load the index.html of the app. win.loadFile('ui/arduino/index.html') + // If the app takes a while to open, show splash screen + // Create the splash screen + splash = new BrowserWindow({ + width: 450, + height: 140, + transparent: true, + frame: false, + alwaysOnTop: true + }); + splash.loadFile('ui/arduino/splash.html') + splashTimestamp = Date.now() + + win.once('ready-to-show', () => { + if (Date.now()-splashTimestamp > 1000) { + splash.destroy() + } else { + setTimeout(() => { + splash.destroy() + }, 500) + } + win.show() + }) + registerIPCHandlers(win, ipcMain, app) registerMenu(win) app.on('activate', () => { if (BrowserWindow.getAllWindows().length === 0) createWindow() }) - // app.on('window-all-closed', () => { - // if (process.platform !== 'darwin') app.quit() - // }) } - -// TODO: Loading splash screen -app.whenReady().then(createWindow) +app.on('ready', createWindow) diff --git a/ui/arduino/splash.html b/ui/arduino/splash.html new file mode 100644 index 0000000..15ae0b4 --- /dev/null +++ b/ui/arduino/splash.html @@ -0,0 +1,21 @@ + + + + + Arduino Lab for MicroPython + + + + Arduino Lab For MicroPython Logo + + 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