From 518b98d26caccc5af5537aeef159193a13214e95 Mon Sep 17 00:00:00 2001 From: Ev Bogue Date: Thu, 17 Jun 2021 09:33:41 -0500 Subject: [PATCH] cache message and redraw screen --- client.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/client.js b/client.js index d2a9f72..4bde756 100644 --- a/client.js +++ b/client.js @@ -10,6 +10,8 @@ var prompty = '$ ' var key +var log = [] + async function read() { for await(const line of readLines(Deno.stdin)) { publish({'text': line}, key).then(bog => { @@ -39,7 +41,11 @@ keys('wiredove').then(keypair => { unbox(msg.data, key).then(unboxed => { open(unboxed, key).then(opened => { var message = JSON.parse(opened) - console.log('\n' + message.author.substring(0, 10) + ' ' + message.text + ' ' + message.timestamp) + log.push(message) + console.clear() + log.forEach(mssg => { + console.log(mssg.author.substring(0, 10) + ' ' + mssg.text + ' ' + mssg.timestamp) + }) }) Deno.stdout.write(new TextEncoder().encode(prompty)) }) -- 2.34.4