add day 23

This commit is contained in:
Zoe
2022-10-16 01:07:28 -05:00
parent 4e485b421c
commit e505c78616
38 changed files with 9586 additions and 0 deletions

35
day23/src/entry-client.ts Normal file
View File

@@ -0,0 +1,35 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { appState } from './main';
let SSR: boolean;
export function isSSR() {
if (!import.meta.env.SSR) {
if (SSR !== undefined) return SSR;
SSR = !!document.getElementById('app')?.getAttribute('data-server-rendered');
return SSR;
}
}
async function initClient() {
if (import.meta.env.SSR) return;
await import('./style.css');
const { renderPage } = await import('./lib/router/pageRenderer');
await renderPage();
window.onpopstate = async (e: PopStateEvent) => {
if (e.state === null) {
return;
}
await renderPage();
};
}
// async function initSSR() {
// const { hydratePage } = await import('./lib/router/hydrationManager');
// await hydratePage();
// }
if (!import.meta.env.SSR) {
if (!isSSR()) initClient();
}