diff options
author | RaindropsSys <raindrops@equestria.dev> | 2024-06-13 15:46:03 +0200 |
---|---|---|
committer | RaindropsSys <raindrops@equestria.dev> | 2024-06-13 15:46:03 +0200 |
commit | e44e2fe070484e06d384a31ef2699c3a2d5d474e (patch) | |
tree | 2d5eb5d1b01646270d18cf1f2d94519966d6e7de /src/index.ts | |
download | faunerie-e44e2fe070484e06d384a31ef2699c3a2d5d474e.tar.gz faunerie-e44e2fe070484e06d384a31ef2699c3a2d5d474e.tar.bz2 faunerie-e44e2fe070484e06d384a31ef2699c3a2d5d474e.zip |
GitHub migration
Diffstat (limited to 'src/index.ts')
-rwxr-xr-x | src/index.ts | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/index.ts b/src/index.ts new file mode 100755 index 0000000..f6d526f --- /dev/null +++ b/src/index.ts @@ -0,0 +1,41 @@ +import {ipcRenderer} from "electron"; +import {PrisbeamApp} from "./PrisbeamApp"; + +let loaded = false; + +window.onload = () => { + loaded = true; +} + +// noinspection JSUnusedGlobalSymbols +export function runApp(bootstrap: any) { + ipcRenderer.on('path', (_, appDataPath) => { + let instance = window['instance'] = new PrisbeamApp(bootstrap); + instance.dataStore.appData = appDataPath; + + let loadInterval = setInterval(() => { + if (loaded) { + clearInterval(loadInterval); + instance.loadApp(); + } + }); + + window.onclose = () => { + instance.dataStore.close = true; + } + + window.onbeforeunload = (e: DOMEvent) => { + if (instance.dataStore.database && !instance.dataStore.unloaded) { + e.preventDefault(); + instance.safeReload(); + } + }; + + document.getElementById("preview").addEventListener('hide.bs.modal', () => { + document.getElementById("preview-content").innerHTML = ""; + instance.display.updateTitle(); + }); + + instance.bootstrapTooltips(); + }); +} |