From 0bbbb39ce8ded2b3e6d5413511a48449a83dfd9c Mon Sep 17 00:00:00 2001 From: Holden Rohrer Date: Sun, 29 Dec 2019 18:03:09 -0500 Subject: fixed bug where jarvis didn't actively update uptime --- examples/jarvis.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/examples/jarvis.js b/examples/jarvis.js index 0b24be7..5103934 100644 --- a/examples/jarvis.js +++ b/examples/jarvis.js @@ -39,7 +39,7 @@ function identity(send){ } function init(){ - writes.enqueue(...notif.towrite()); // A non-conservative write because I don't want to write the fetch request (also, faster in many cases because the notif is <200 chars) + notifRefresh(); } function tileHandler(send, source, tiles){ @@ -65,13 +65,16 @@ notifsrc = '\ ' var hrsUp = 0; function notifRefresh(){ - notif.adhoc(notifsrc.replace('UPTIME', hrsUp + 'hrs')); + newnotif.adhoc(notifsrc.replace('UPTIME', hrsUp + 'hrs')); + let diff = newnotif.copy(); + diff.comb(notif, comb.sub); + notif = newnotif; + writes.enqueue(...diff.towrite()); + var ctrl = ms(notif); setTimeout(notifRefresh, 3600*1000); hrsUp += 1; } -notifRefresh(); notif.loc = [-6, 20]; -var ctrl = ms(notif); function protectArea(send, tiles, locs){ let tilesize = [8, 16]; // This may be exportable to an external util/tool -- cgit