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.name === 'form') { document.body.innerHTML = '' document.body.appendChild(Form.view(route.config, showPage)) } else if (route.name === '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)) }