work on navbar

This commit is contained in:
Géry Debongnie
2019-02-05 08:56:33 +01:00
parent 05e9797f7a
commit 52d855241d
14 changed files with 138 additions and 59 deletions
+20
View File
@@ -2,3 +2,23 @@ import { BaseWidget } from "../core/base_widget";
import { Env } from "../env";
export class Widget<Props, State> extends BaseWidget<Env, Props, State> {}
// TODO: move this to PureComponent in core
export class PureWidget<Props, State> extends Widget<Props, State> {
shouldUpdate(nextProps: Props): boolean {
for (let k in nextProps) {
if (nextProps[k] !== this.props[k]) {
return true;
}
}
return false;
}
async updateState(nextState: Partial<State>) {
for (let k in nextState) {
if (nextState[k] !== this.state[k]) {
return;
}
}
return super.updateState(nextState);
}
}