-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
App.svelte
64 lines (51 loc) · 1.62 KB
/
App.svelte
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<script>
import { on } from "@/libs/socket.io";
import i18next from "@/libs/i18next";
import obsStore from "@/stores/obs";
import filesStore from "@/stores/files";
import panelsStore from "@/stores/panels";
import twitchStore from "@/stores/twitch";
import commandStore from "@/stores/command";
import overlayStore from "@/stores/overlay";
import actionsStore from "@/stores/actions";
import i18nextStore from "@/stores/i18next";
import { loadUsedFonts } from "../../libs/fonts";
import appStore, { initialized } from "@/stores/app";
import Connected from "@/components/App/Connected.svelte";
import Notify from "@/components/App/Notify/Notify.svelte";
import Connecting from "@/components/App/Connecting.svelte";
import Disconnected from "@/components/App/Disconnected.svelte";
import ElectronTopbar from "@/components/App/ElectronTopbar.svelte";
let component = Connecting;
async function initialize() {
await i18next(await i18nextStore());
await actionsStore();
await overlayStore();
await commandStore();
await panelsStore();
await twitchStore();
await filesStore();
await appStore();
await obsStore();
loadUsedFonts();
initialized.set(true);
}
on("connect", async () => {
component = Connecting;
await initialize();
setTimeout(() => {
if (component !== Disconnected) {
component = Connected;
}
}, 1000);
});
on("disconnect", () => {
component = Disconnected;
});
</script>
<div class="flex flex-col h-full">
<ElectronTopbar />
<svelte:component this="{component}" />
</div>
<div id="modal"></div>
<Notify />