import Main from './components/Main.svelte'; import { getItem } from './storage'; import { authWithToken, useAuthHandlers } from './auth'; import { initResponsiveHandlers } from './responsive'; import { useDebuggingApi } from './debuggingapi'; import gateway, { GatewayEventType } from './gateway'; import "@material-design-icons/font"; function handleGatewaySettlement() { 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); } function main() { useDebuggingApi(); useAuthHandlers(); initResponsiveHandlers(); gateway.subscribe(GatewayEventType.Ready, handleGatewaySettlement); gateway.subscribe(GatewayEventType.Close, handleGatewaySettlement); authWithToken(getItem("auth:token")); } main();