From def14c0f2187f61bcef00f1298fcc60743b44c1b Mon Sep 17 00:00:00 2001 From: Maks Jopek Date: Thu, 27 May 2021 11:02:03 +0200 Subject: Version v1.1.0 --- src/index.ts | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'src/index.ts') diff --git a/src/index.ts b/src/index.ts index 5845a7d..c101b0f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -36,19 +36,16 @@ export default class Irc { } async poll(): Promise { - console.log("polling"); - fetch(this.messages.url + "poll") - .then(msg => - msg.json().then(msg => { - this.messages.addMessage(msg); - const update = - document.activeElement === this.input ? "bottom" : "relative"; - - this.helpers.updateScrollbar(update); - this.poll(); - }) - ) + .then(async res => { + const msg = await res.json(); + this.messages.addMessage(msg); + const update = + document.activeElement === this.input ? "bottom" : "relative"; + + this.helpers.updateScrollbar(update); + this.poll(); + }) .catch(this.poll); } -- cgit v1.3.1