import { lazy } from "solid-js";
import { render } from "solid-js/web";
import { Router, useRoutes, hashIntegration } from "@solidjs/router";
// import { Router } from "solid-app-router";
// import Routers from "./router/index";


const routes = [
    {
        path: "/",
        component: lazy(() => import("./pages/BigScreen/Home"))
    },
    {
        path: "/common",
        component: lazy(() => import("./pages/CommonBigScreen/Home"))
    }
];


import utils from "./utils/index"

import "./assets/style/layout.css"
import "./assets/style/base.css"

window.onresize = function () {
    utils.screenSize()
}

// 兼容requestAnimFrame
window.requestAnimFrame = (function () {
    return window.requestAnimationFrame ||
        window.webkitRequestAnimationFrame ||
        window.mozRequestAnimationFrame ||
        function (callback) {
            window.setTimeout(callback, 60000 / 60);
        };
})();
window.cancelrequestAnimFrame = (function () {
    return window.cancelAnimationFrame ||
        window.webkitCancelAnimationFrame ||
        window.mozCancelAnimationFrame ||
        function (ID) {
            window.clearTimeout(ID);
        };
})();
render(() => {
    // 初始化根字体
    utils.screenSize()
    const Routes = useRoutes(routes);
    return (
        // <Router>
        //     <Routers />
        // </Router>
        <Router source={hashIntegration()}>
            <Routes />
        </Router>
    )
}, document.getElementById("root"));
