blob: 436a217cd84d235c6351167aeef300d5c38c167a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import * as Config from 'config'
import * as Form from 'view/form'
import * as Timer from 'view/timer'
import * as Router from 'router'
export function showPage(route: Router.Route) {
if (route.kind === Router.Kind.Form) {
document.body.innerHTML = ''
document.body.appendChild(Form.view(route.config, showPage))
} else if (route.kind === Router.Kind.Timer) {
document.body.innerHTML = ''
document.body.appendChild(Timer.view(route.config, showPage))
}
}
showPage(Router.from(document.location))
window.onpopstate = (event: Event) => {
Timer.clearInterval()
showPage(Router.from(document.location))
}
|