35 lines
959 B
JavaScript
Raw Normal View History

2025-01-23 20:02:06 +03:00
import {Cookie} from "./tg_app/Cookie.js";
2025-01-05 17:23:49 +03:00
import {TgApp} from "./tg_app/TgApp.js";
2025-01-23 20:02:06 +03:00
import {SimpleRouter} from "./tg_app/SimpleRouter.js";
2025-01-03 18:34:03 +03:00
document.addEventListener("DOMContentLoaded", () => {
2025-01-05 17:23:49 +03:00
let tg = window.Telegram.WebApp;
let tgApp = new TgApp("tg_app", tg.initDataUnsafe.user.id);
2025-01-04 01:38:59 +03:00
2025-01-23 20:02:06 +03:00
// const router = new Router({
// mode: 'hash',
// root: '/miniapp'
// });
2025-01-19 17:15:58 +03:00
2025-01-23 20:02:06 +03:00
const cookie = new Cookie();
const routes = {
'/miniapp': () => {
cookie.setCookie("dialog_id", tg.initDataUnsafe.user.id, 3)
2025-01-19 17:15:58 +03:00
tgApp.actionMain();
2025-01-23 20:02:06 +03:00
},
};
// Инициализация роутера
const router = new SimpleRouter(routes);
// const router
// .add('/', () => {
// cookie.setCookie("dialog_id", tg.initDataUnsafe.user.id, 3)
// tgApp.actionMain();
// })
// .add('/scanner', () => {
// tgApp.createScanner();
// });
2025-01-19 17:15:58 +03:00
2025-01-03 18:34:03 +03:00
});