Merge pull request #1713 from rigrig/fix-widcal

widcal: fix memory leak
pull/1716/head
Gordon Williams 2022-04-19 10:30:19 +01:00 committed by GitHub
commit df808092f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

View File

@ -1 +1,2 @@
0.01: First version
0.02: Fix memory leak

View File

@ -1,7 +1,7 @@
{
"id": "widcal",
"name": "Calendar Widget",
"version": "0.01",
"version": "0.02",
"description": "Widget with the current date",
"icon": "widget.png",
"type": "widget",

View File

@ -24,7 +24,8 @@
]);
}
// 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);
}
};
})();