Use const variables when applicable

This commit is contained in:
2019-11-17 18:25:14 +09:00
parent 454e8572e3
commit 878f1913e3
39 changed files with 405 additions and 403 deletions

View File

@ -14,10 +14,10 @@ export default class SVGIcon extends HTMLElement {
}
async render() {
let cache = SVGIcon.cache.get(this.name)
const cache = SVGIcon.cache.get(this.name)
if(cache) {
let svg = await cache
const svg = await cache
Diff.mutations.queue(() => {
// Remove all existing child nodes
@ -33,8 +33,8 @@ export default class SVGIcon extends HTMLElement {
}
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)
const url = `//media.notify.moe/images/icons/${this.name}.svg`
const response = await fetch(url)
if(!response.ok) {
console.warn(`Failed loading SVG icon: ${url}`)
@ -42,11 +42,11 @@ export default class SVGIcon extends HTMLElement {
return
}
let text = await response.text()
const text = await response.text()
Diff.mutations.queue(() => {
this.innerHTML = text
let svg = this.firstChild
const svg = this.firstChild
if(!svg) {
console.warn("Invalid SVG icon:", svg)