diff options
author | Holden Rohrer <holden.rohrer@gmail.com> | 2020-01-08 18:06:31 -0500 |
---|---|---|
committer | Holden Rohrer <holden.rohrer@gmail.com> | 2020-01-08 18:06:31 -0500 |
commit | a73606df8d833150a7771c919a9d15c3b2cee7b3 (patch) | |
tree | 07c7dc29d1f37663001e1234bc9ab59085cde37d /examples | |
parent | 526ff0f8a9e57b4a0090a3ee02209b64e6af6f28 (diff) |
added "call counter" to jarvis
Diffstat (limited to 'examples')
-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); |