2022-04-28 18:48:44 +03:00
|
|
|
import Main from './components/Main.svelte';
|
2022-05-06 01:55:21 +03:00
|
|
|
import { getItem } from './storage';
|
2022-05-05 20:39:24 +03:00
|
|
|
import { authWithToken, useAuthHandlers } from './auth';
|
2022-04-27 05:03:47 +03:00
|
|
|
import { initResponsiveHandlers } from './responsive';
|
2022-05-05 21:49:25 +03:00
|
|
|
import { useDebuggingApi } from './debuggingapi';
|
2022-08-28 20:52:34 +03:00
|
|
|
import gateway, { GatewayEventType } from './gateway';
|
2022-04-14 16:56:01 +03:00
|
|
|
|
2022-08-28 20:52:34 +03:00
|
|
|
function handleGatewaySettlement() {
|
|
|
|
initResponsiveHandlers();
|
2022-04-14 00:31:03 +03:00
|
|
|
|
2022-08-28 20:52:34 +03:00
|
|
|
const loadingElement = document.getElementById("pre--loading-screen");
|
|
|
|
if (loadingElement) {
|
|
|
|
loadingElement.parentElement.removeChild(loadingElement);
|
|
|
|
}
|
|
|
|
|
|
|
|
const app = new Main({
|
|
|
|
target: document.body
|
|
|
|
});
|
|
|
|
window.__waffle.app = app;
|
|
|
|
|
|
|
|
gateway.unsubscribe(GatewayEventType.Ready, handleGatewaySettlement);
|
|
|
|
gateway.unsubscribe(GatewayEventType.Close, handleGatewaySettlement);
|
2022-04-17 20:23:20 +03:00
|
|
|
}
|
|
|
|
|
2022-08-28 20:52:34 +03:00
|
|
|
function main() {
|
|
|
|
useDebuggingApi();
|
|
|
|
useAuthHandlers();
|
|
|
|
|
|
|
|
gateway.subscribe(GatewayEventType.Ready, handleGatewaySettlement);
|
|
|
|
gateway.subscribe(GatewayEventType.Close, handleGatewaySettlement);
|
|
|
|
|
|
|
|
authWithToken(getItem("auth:token"));
|
|
|
|
}
|
2022-04-14 00:31:03 +03:00
|
|
|
|
2022-08-28 20:52:34 +03:00
|
|
|
main();
|