blob: 5413d832df0f3f12bf1b2cb20e3807ea01dfab47 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
import {ipcRenderer} from "electron";
import {FaunerieApp} from "./FaunerieApp";
let loaded = false;
window.onload = () => {
loaded = true;
}
// noinspection JSUnusedGlobalSymbols
export function runApp(bootstrap: any) {
ipcRenderer.on('path', (_, appDataPath) => {
let instance = window['instance'] = new FaunerieApp(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();
});
}
|