fix eslint in more js files

This commit is contained in:
Vitaly 2023-09-27 18:21:41 +03:00
commit 3acedbb88b
3 changed files with 20 additions and 20 deletions

View file

@ -154,7 +154,7 @@ class Hotbar extends LitElement {
const slotStack = slotEl.children[1]
slotIcon.style['background-position-x'] = `-${sprite.x}px`
slotIcon.style['background-position-y'] = `-${sprite.y}px`
slotStack.innerText = newItem?.count > 1 ? newItem.count : ''
slotStack.textContent = newItem?.count > 1 ? newItem.count : ''
})
}
@ -167,7 +167,7 @@ class Hotbar extends LitElement {
const slotStack = slotEl.children[1]
slotIcon.style['background-position-x'] = `-${sprite.x}px`
slotIcon.style['background-position-y'] = `-${sprite.y}px`
slotStack.innerText = item?.count > 1 ? item.count : ''
slotStack.textContent = item?.count > 1 ? item.count : ''
}
}

View file

@ -163,8 +163,8 @@ class KeyBindsScreen extends LitElement {
}
onResetAllPress () {
for (let i = 0; i < this.keymaps.length; i++) {
this.keymaps[i].key = this.keymaps[i].defaultKey
for (const keymap of this.keymaps) {
keymap.key = keymap.defaultKey
}
this.requestUpdate()
}

View file

@ -27,6 +27,22 @@ class Notification extends LitElement {
}
}
constructor () {
super()
this.renderHtml = false
let timeout
subscribe(notification, () => {
if (timeout) clearTimeout(timeout)
this.requestUpdate()
if (!notification.show) return
this.renderHtml = true
if (!notification.autoHide) return
timeout = setTimeout(() => {
notification.show = false
}, 3000)
})
}
render () {
if (!this.renderHtml) return
const show = notification.show && notification.message
@ -45,22 +61,6 @@ class Notification extends LitElement {
}
}
constructor () {
super()
this.renderHtml = false
let timeout
subscribe(notification, () => {
if (timeout) clearTimeout(timeout)
this.requestUpdate()
if (!notification.show) return
this.renderHtml = true
if (!notification.autoHide) return
timeout = setTimeout(() => {
notification.show = false
}, 3000)
})
}
static get styles () {
return css`
.notification {