summaryrefslogtreecommitdiff
path: root/packages/frontend/src/scripts
diff options
context:
space:
mode:
authorKevinWh0 <45321184+KevinWh0@users.noreply.github.com>2024-05-02 17:38:16 +0200
committerKevinWh0 <45321184+KevinWh0@users.noreply.github.com>2024-05-02 17:38:16 +0200
commit42c29697070f40c994e8661f8b88ea652b46f162 (patch)
treebf50ab99df8fa07982233c89b93d50084b32863d /packages/frontend/src/scripts
parentremoved use of settimeout (diff)
downloadsharkey-42c29697070f40c994e8661f8b88ea652b46f162.tar.gz
sharkey-42c29697070f40c994e8661f8b88ea652b46f162.tar.bz2
sharkey-42c29697070f40c994e8661f8b88ea652b46f162.zip
fixes
Diffstat (limited to 'packages/frontend/src/scripts')
-rw-r--r--packages/frontend/src/scripts/favicon-dot.ts17
1 files 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<HTMLLinkElement> {
return new Promise((resolve, reject) => {
const favicon = document.querySelector<HTMLLinkElement>('link[rel$=icon]') ?? this._createFaviconElem();
- if (favicon === document.querySelector<HTMLLinkElement>('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);
});
}