aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorHolden Rohrer <holden.rohrer@gmail.com>2019-12-29 18:03:09 -0500
committerHolden Rohrer <holden.rohrer@gmail.com>2019-12-29 18:03:09 -0500
commit0bbbb39ce8ded2b3e6d5413511a48449a83dfd9c (patch)
treee1114825bf384b4ffc0d9894aa7528e9e0eff62c /examples
parentf3256df166f1f167fb32b3d725921a7929101dde (diff)
fixed bug where jarvis didn't actively update uptime
Diffstat (limited to 'examples')
-rw-r--r--examples/jarvis.js11
1 files 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