add day 6

This commit is contained in:
Zoe
2022-09-28 22:00:34 -05:00
parent 76f93f24e3
commit 2df178410b
27 changed files with 4129 additions and 0 deletions

25
day6/src/main.ts Normal file
View File

@@ -0,0 +1,25 @@
import { Reactive } from './lib/ReactiveObject'
import { loadPage, hydratePage } from './lib/router';
import { getCookie } from './lib/cookieManager';
import '/src/style.css';
export const appState = new Reactive({
count: 0,
cookie: getCookie('username'),
text: '',
year: '',
cookiedata: ""
});
// equivalent to mounted() on svelte or vue
window.addEventListener('load', async () => {
// loadPage after all the index is loaded
if (!import.meta.env.SSR) {
await loadPage()
} else {
await hydratePage()
}
window.onpopstate = async () => {
await loadPage()
}
})