~ev/wiredove-chat

518b98d26caccc5af5537aeef159193a13214e95 — Ev Bogue 1 year, 14 days ago 5f96b6a
cache message and redraw screen
1 files changed, 7 insertions(+), 1 deletions(-)

M client.js
M client.js => client.js +7 -1
@@ 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))
      })