use right update functions
This commit is contained in:
parent
db0fc77698
commit
352f059eb2
@ -43,7 +43,6 @@ function onUpdateNotification(f: () => void) {
|
|||||||
class Router extends preact.Component<any,any> {
|
class Router extends preact.Component<any,any> {
|
||||||
static setRoute(s: string): void {
|
static setRoute(s: string): void {
|
||||||
window.location.hash = s;
|
window.location.hash = s;
|
||||||
preact.rerender();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static getRoute(): string {
|
static getRoute(): string {
|
||||||
@ -64,7 +63,7 @@ class Router extends preact.Component<any,any> {
|
|||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
console.log("router mounted");
|
console.log("router mounted");
|
||||||
window.onhashchange = () => {
|
window.onhashchange = () => {
|
||||||
this.forceUpdate();
|
this.setState({});
|
||||||
for (let f of Router.routeHandlers) {
|
for (let f of Router.routeHandlers) {
|
||||||
f();
|
f();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user