From 9338f7bdebc2207c29ae2784946d4ffb6dc7039b Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Sat, 31 Aug 2019 13:45:42 +0900 Subject: [PATCH] Improved type safety --- scripts/Elements/svg-icon/svg-icon.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/Elements/svg-icon/svg-icon.ts b/scripts/Elements/svg-icon/svg-icon.ts index b3893a9b..9cbebfa3 100644 --- a/scripts/Elements/svg-icon/svg-icon.ts +++ b/scripts/Elements/svg-icon/svg-icon.ts @@ -14,7 +14,7 @@ export default class SVGIcon extends HTMLElement { } async render() { - let cache = SVGIcon.cache[this.name] + let cache = SVGIcon.cache.get(this.name) if(cache) { let text = await cache @@ -22,7 +22,7 @@ export default class SVGIcon extends HTMLElement { return } - SVGIcon.cache[this.name] = new Promise(async (resolve, reject) => { + SVGIcon.cache.set(this.name, new Promise(async (resolve, reject) => { let url = `//media.notify.moe/images/icons/${this.name}.svg` let response = await fetch(url) @@ -35,7 +35,7 @@ export default class SVGIcon extends HTMLElement { let text = await response.text() Diff.mutations.queue(() => this.innerHTML = text) resolve(text) - }) + })) } get name() {