diff options
-rw-r--r-- | examples/jarvis.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/examples/jarvis.js b/examples/jarvis.js index 065100d..6bf2286 100644 --- a/examples/jarvis.js +++ b/examples/jarvis.js @@ -84,14 +84,18 @@ var notifsrc = '\ \n\ For a node.js YWOT api: \n\ & http://github.com/feynmansfedora/ywot-clean \n\ -& Try `jarvis` today. Uptime: UPTIME \n\ +& Try `jarvis` today. Uptime: UPTIME. Called: JARVISx\n\ ' var minsUp = 0; +var callct = 0; var ctrl; function notifRefresh(){ let newnotif = new Space(); newnotif.loc = [-6, 20]; - newnotif.adhoc(notifsrc.replace('UPTIME', Math.floor(minsUp/60) + 'h' + minsUp%60 + 'm')); + text = notifsrc; + text = text.replace('UPTIME', Math.floor(minsUp/60) + 'h' + minsUp%60 + 'm'); + text = text.replace('JARVIS', callct); + newnotif.adhoc(text); let diff = newnotif.copy(); if (typeof notif !== 'undefined') diff.comb(notif, comb.sub); notif = newnotif; @@ -148,10 +152,10 @@ function detectPrompt(send, tiles, locs){ // tries to detect the prompt ('jarvis let response = new Space(); response.adhoc('yes, my liege'); -let writes = new Queue(1000, 200, (elems) => main.write(elems)); - function respond(coord){ console.log('called at', coord); + callct += 1; + notifRefresh(); response.loc = coord; writes.enqueue(...response.towrite()); read.update(response); |