mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-02-26 04:40:10 +08:00
preload/splash.ts
-> preload/index.ts
This commit is contained in:
parent
042f7af691
commit
f129465d28
@ -1,4 +1,3 @@
|
||||
|
||||
function domReady(condition: DocumentReadyState[] = ['complete', 'interactive']) {
|
||||
return new Promise(resolve => {
|
||||
if (condition.includes(document.readyState)) {
|
||||
@ -84,5 +83,10 @@ function useLoading() {
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
const { appendLoading, removeLoading } = useLoading()
|
||||
window.removeLoading = removeLoading
|
||||
domReady().then(appendLoading)
|
||||
|
||||
window.onmessage = ev => {
|
||||
ev.data.payload === 'removeLoading' && removeLoading()
|
||||
}
|
||||
|
||||
setTimeout(removeLoading, 4999)
|
@ -23,7 +23,7 @@ export default defineConfig({
|
||||
preload: {
|
||||
input: {
|
||||
// You can configure multiple preload here
|
||||
splash: join(__dirname, 'electron/preload/splash.ts'),
|
||||
index: join(__dirname, 'electron/preload/index.ts'),
|
||||
},
|
||||
vite: {
|
||||
build: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user