diff --git a/src/menus/components/hotbar.js b/src/menus/components/hotbar.js index c4dd7477..57f0274b 100644 --- a/src/menus/components/hotbar.js +++ b/src/menus/components/hotbar.js @@ -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 : '' } } diff --git a/src/menus/keybinds_screen.js b/src/menus/keybinds_screen.js index d82f0210..739199d9 100644 --- a/src/menus/keybinds_screen.js +++ b/src/menus/keybinds_screen.js @@ -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() } diff --git a/src/menus/notification.js b/src/menus/notification.js index fb42ade0..4982fd6f 100644 --- a/src/menus/notification.js +++ b/src/menus/notification.js @@ -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 {