From 42c29697070f40c994e8661f8b88ea652b46f162 Mon Sep 17 00:00:00 2001 From: KevinWh0 <45321184+KevinWh0@users.noreply.github.com> Date: Thu, 2 May 2024 17:38:16 +0200 Subject: [PATCH] fixes --- packages/frontend/src/scripts/favicon-dot.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/frontend/src/scripts/favicon-dot.ts b/packages/frontend/src/scripts/favicon-dot.ts index d54991f067..2e05171772 100644 --- a/packages/frontend/src/scripts/favicon-dot.ts +++ b/packages/frontend/src/scripts/favicon-dot.ts @@ -19,7 +19,6 @@ class FavIconDot { this.ctx = this.canvas.getContext('2d'); this.faviconImage = document.createElement('img'); - this.faviconImage.src = this.faviconEL.href; this.hasLoaded = new Promise((resolve, reject) => { (this.faviconImage as HTMLImageElement).onload = () => { @@ -32,20 +31,20 @@ class FavIconDot { reject('Failed to create favicon img element'); }; }); + + this.faviconImage.src = this.faviconEL.href; } private async getOrMakeFaviconElement() : Promise { return new Promise((resolve, reject) => { const favicon = document.querySelector('link[rel$=icon]') ?? this._createFaviconElem(); - if (favicon === document.querySelector('link[rel$=icon]')) { - favicon.onload = () => { - resolve(favicon); - }; + favicon.onload = () => { + resolve(favicon); + }; - favicon.onerror = () => { - reject('Failed to load favicon'); - }; - } + favicon.onerror = () => { + reject('Failed to load favicon'); + }; resolve(favicon); }); }