mya/www/src/main.js
Fabio Micheluz 04b045714b
Some checks are pending
Build Android APK / build (push) Waiting to run
android ok
2026-01-22 11:28:12 +01:00

36 lines
956 B
JavaScript

// src/main.js
import { initStorage } from './storage/index.js';
import { showSetupPage, hideSetupPage } from './setup.js';
import { setConfig } from './state.js';
import { startLauncher } from './starter.js';
import { initSafeArea } from './safearea.js';
document.addEventListener('DOMContentLoaded', async () => {
initSafeArea();
const Storage = await initStorage();
const cfg = await Storage.loadConfig();
if (!cfg) {
await showSetupPage(Storage);
} else {
setConfig({ url: cfg.url, user: cfg.user, password: cfg.password });
hideSetupPage();
await startLauncher(Storage);
}
// 6 click per aprire la setup page
let tapCount = 0;
let tapTimer = null;
document.addEventListener('click', async () => {
tapCount++;
if (tapTimer) clearTimeout(tapTimer);
tapTimer = setTimeout(() => { tapCount = 0; }, 600);
if (tapCount >= 6) {
tapCount = 0;
await showSetupPage(Storage);
}
});
});