From 554a50cfb5f7eaf093b6d4f73e53dac056909344 Mon Sep 17 00:00:00 2001 From: Holden Rohrer Date: Sun, 29 Dec 2019 20:04:23 -0500 Subject: retooling of notifRefresh --- examples/jarvis.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/jarvis.js b/examples/jarvis.js index 3572a3c..3c985bb 100644 --- a/examples/jarvis.js +++ b/examples/jarvis.js @@ -61,7 +61,6 @@ function tileHandler(send, source, tiles){ }); } -var notif = new Space(); notifsrc = '\ \n\ For a node.js YWOT api: \n\ @@ -69,17 +68,19 @@ notifsrc = '\ & Try `jarvis` today. Uptime: UPTIME \n\ ' var hrsUp = 0; +var ctrl; function notifRefresh(){ + let newnotif = new Space(); + newnotif.loc = [-6, 20]; newnotif.adhoc(notifsrc.replace('UPTIME', hrsUp + 'hrs')); let diff = newnotif.copy(); - diff.comb(notif, comb.sub); + if (typeof notif !== 'undefined') diff.comb(notif, comb.sub); notif = newnotif; writes.enqueue(...diff.towrite()); - var ctrl = ms(notif); + ctrl = ms(notif); setTimeout(notifRefresh, 3600*1000); hrsUp += 1; } -notif.loc = [-6, 20]; function protectArea(send, tiles, locs){ let tilesize = [8, 16]; // This may be exportable to an external util/tool -- cgit