update UI when hash changes
This commit is contained in:
+5
-2
@@ -3,9 +3,12 @@ import {RootViewModel} from "./RootViewModel.js";
|
||||
import {RootView} from "./RootView.js";
|
||||
|
||||
export async function main(container) {
|
||||
const vm = new RootViewModel(xhrRequest, location.hash);
|
||||
vm.load();
|
||||
const vm = new RootViewModel(xhrRequest);
|
||||
vm.updateHash(location.hash);
|
||||
window.__rootvm = vm;
|
||||
const view = new RootView(vm);
|
||||
container.appendChild(view.mount());
|
||||
window.addEventListener('hashchange', event => {
|
||||
vm.updateHash(location.hash);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user