widcal: fix memory leak
Repeated redrawing would create multiple redraw-timeoutsmaster
parent
dc273a7a12
commit
4f17ed02d6
|
|
@ -1 +1,2 @@
|
||||||
0.01: First version
|
0.01: First version
|
||||||
|
0.02: Fix memory leak
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "widcal",
|
"id": "widcal",
|
||||||
"name": "Calendar Widget",
|
"name": "Calendar Widget",
|
||||||
"version": "0.01",
|
"version": "0.02",
|
||||||
"description": "Widget with the current date",
|
"description": "Widget with the current date",
|
||||||
"icon": "widget.png",
|
"icon": "widget.png",
|
||||||
"type": "widget",
|
"type": "widget",
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,8 @@
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
// redraw when date changes
|
// redraw when date changes
|
||||||
setTimeout(()=>WIDGETS["cal"].draw(), (86401 - Math.floor(date/1000) % 86400)*1000);
|
if (WIDGETS["cal"].to) clearTimeout(WIDGETS["cal"].to);
|
||||||
|
WIDGETS["cal"].to = setTimeout(()=>WIDGETS["cal"].draw(), (86401 - Math.floor(date/1000) % 86400)*1000);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue