mirror of https://github.com/espruino/BangleApps
widcw: fix memory leak
Repeated redrawing would create multiple redraw-timeoutspull/2064/head
parent
489582ee91
commit
ded3b25d3e
|
@ -1 +1,2 @@
|
||||||
0.01: First version
|
0.01: First version
|
||||||
|
0.02: Fix memory leak
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "widcw",
|
"id": "widcw",
|
||||||
"name": "Calendar Week Widget",
|
"name": "Calendar Week Widget",
|
||||||
"version": "0.01",
|
"version": "0.02",
|
||||||
"description": "Widget which shows the current calendar week",
|
"description": "Widget which shows the current calendar week",
|
||||||
"icon": "widget.png",
|
"icon": "widget.png",
|
||||||
"type": "widget",
|
"type": "widget",
|
||||||
|
|
|
@ -34,8 +34,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// redraw when date changes
|
// redraw when date changes
|
||||||
setTimeout(()=>WIDGETS["widcw"].draw(), (86401 - Math.floor(date/1000) % 86400)*1000);
|
if (WIDGETS["widcw"].to) clearTimeout(WIDGETS["widcw"].to);
|
||||||
|
WIDGETS["widcw"].to = setTimeout(()=>WIDGETS["widcw"].draw(), (86401 - Math.floor(date/1000) % 86400)*1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add your widget
|
// add your widget
|
||||||
|
|
Loading…
Reference in New Issue