Improved type safety
This commit is contained in:
parent
453f6cdbb0
commit
9338f7bdeb
@ -14,7 +14,7 @@ export default class SVGIcon extends HTMLElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async render() {
|
async render() {
|
||||||
let cache = SVGIcon.cache[this.name]
|
let cache = SVGIcon.cache.get(this.name)
|
||||||
|
|
||||||
if(cache) {
|
if(cache) {
|
||||||
let text = await cache
|
let text = await cache
|
||||||
@ -22,7 +22,7 @@ export default class SVGIcon extends HTMLElement {
|
|||||||
return
|
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 url = `//media.notify.moe/images/icons/${this.name}.svg`
|
||||||
let response = await fetch(url)
|
let response = await fetch(url)
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ export default class SVGIcon extends HTMLElement {
|
|||||||
let text = await response.text()
|
let text = await response.text()
|
||||||
Diff.mutations.queue(() => this.innerHTML = text)
|
Diff.mutations.queue(() => this.innerHTML = text)
|
||||||
resolve(text)
|
resolve(text)
|
||||||
})
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
get name() {
|
get name() {
|
||||||
|
Loading…
Reference in New Issue
Block a user