diff options
| author | Maks Jopek <maksymilian.jopek@prym-soft.pl> | 2021-05-27 11:02:03 +0200 |
|---|---|---|
| committer | Maks Jopek <maksymilian.jopek@prym-soft.pl> | 2021-05-27 11:02:03 +0200 |
| commit | def14c0f2187f61bcef00f1298fcc60743b44c1b (patch) | |
| tree | cb8af0aba19da9b973c412b4830a424dfd44ab5d /src/index.ts | |
| parent | 1afb236c2d6828883e139652dd8c89d8949b8039 (diff) | |
| download | IRC-def14c0f2187f61bcef00f1298fcc60743b44c1b.tar.gz IRC-def14c0f2187f61bcef00f1298fcc60743b44c1b.tar.zst IRC-def14c0f2187f61bcef00f1298fcc60743b44c1b.zip | |
Version v1.1.0
Diffstat (limited to 'src/index.ts')
| -rw-r--r-- | src/index.ts | 19 |
1 files changed, 8 insertions, 11 deletions
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<void> { - 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"; + .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(); - }) - ) + this.helpers.updateScrollbar(update); + this.poll(); + }) .catch(this.poll); } |
