added debug code to display how often mithril redraws
This commit is contained in:
parent
3f03e8f8ba
commit
184f1cee33
@ -4,8 +4,11 @@ require("./layout.css");
|
||||
|
||||
export default class Layout {
|
||||
private menuActive = false;
|
||||
private drawCount = 0;
|
||||
|
||||
view(vnode: m.Vnode) {
|
||||
this.drawCount = this.drawCount + 1;
|
||||
|
||||
return [
|
||||
<nav class="navbar" role="navigation" aria-label="main navigation">
|
||||
<div class="navbar-brand">
|
||||
@ -16,6 +19,8 @@ export default class Layout {
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
</a>
|
||||
|
||||
<span>{this.drawCount}</span>
|
||||
</div>
|
||||
|
||||
<div id="mainMenu" class={'navbar-menu ' + (this.menuActive ? 'is-active' : '')}>
|
||||
|
@ -17,7 +17,10 @@ export class DashboardPage extends Page {
|
||||
}
|
||||
|
||||
async refresh() {
|
||||
this.status = await MonitorApi.get().fetchStatus();
|
||||
let newStatus = await MonitorApi.get().fetchStatus();
|
||||
if(this.status == null)
|
||||
m.redraw();
|
||||
this.status = newStatus;
|
||||
// todo: update widgets (avoiding to use m.redraw which is a bit costly on CPU)
|
||||
if(this.autoRefresh)
|
||||
setTimeout(() => { if(this.autoRefresh) this.refresh(); }, 500);
|
||||
|
Loading…
Reference in New Issue
Block a user