From 6091ae31aa8e65fbd4155986fb417f8f8ce0a0f2 Mon Sep 17 00:00:00 2001 From: Alain Nussbaumer Date: Sat, 26 Apr 2025 08:20:17 +0200 Subject: [PATCH] [web] Remove unused parameters --- web-src/src/App.vue | 64 ++++++++------------ web-src/src/components/ControlMainVolume.vue | 2 +- web-src/src/filter/index.js | 2 +- web-src/src/pages/PageQueue.vue | 2 +- web-src/src/router/index.js | 4 +- web-src/src/stores/queue.js | 2 +- web-src/src/stores/settings.js | 2 +- 7 files changed, 32 insertions(+), 46 deletions(-) diff --git a/web-src/src/App.vue b/web-src/src/App.vue index 5da2e949..76c33163 100644 --- a/web-src/src/App.vue +++ b/web-src/src/App.vue @@ -81,7 +81,6 @@ export default { }, created() { this.connect() - // Hook the progress bar to start before we move router-view this.$router.beforeEach((to, from, next) => { this.updateClipping() if (!(to.path === from.path && to.hash)) { @@ -92,8 +91,7 @@ export default { } next() }) - // Hook the progress bar to finish after we've finished moving router-view - this.$router.afterEach((to, from) => { + this.$router.afterEach(() => { this.$Progress.finish() }) }, @@ -118,7 +116,6 @@ export default { }, openWebsocket() { const socket = this.createWebsocket() - const vm = this socket.onopen = () => { socket.send( JSON.stringify({ @@ -136,46 +133,36 @@ export default { ] }) ) - vm.updateOutputs() - vm.updatePlayerStatus() - vm.updateLibraryStats() - vm.updateSettings() - vm.updateQueue() - vm.updateSpotify() - vm.updateLastfm() - vm.updatePairing() + this.updateOutputs() + this.updatePlayerStatus() + this.updateLibraryStats() + this.updateSettings() + this.updateQueue() + this.updateSpotify() + this.updateLastfm() + this.updatePairing() } - /* - * When the app becomes active, force an update of all information, - * because we may have missed notifications while the app was inactive. - * There are two relevant events - focus and visibilitychange, so we - * throttle the updates to avoid multiple redundant updates. - */ let updateThrottled = false const updateInfo = () => { if (updateThrottled) { return } - vm.updateOutputs() - vm.updatePlayerStatus() - vm.updateLibraryStats() - vm.updateSettings() - vm.updateQueue() - vm.updateSpotify() - vm.updateLastfm() - vm.updatePairing() + this.updateOutputs() + this.updatePlayerStatus() + this.updateLibraryStats() + this.updateSettings() + this.updateQueue() + this.updateSpotify() + this.updateLastfm() + this.updatePairing() updateThrottled = true setTimeout(() => { updateThrottled = false }, 500) } - /* - * These events are fired when the window becomes active in different - * ways. When this happens, we should update 'now playing' info, etc. - */ window.addEventListener('focus', updateInfo) document.addEventListener('visibilitychange', () => { if (document.visibilityState === 'visible') { @@ -189,29 +176,29 @@ export default { data.notify.includes('update') || data.notify.includes('database') ) { - vm.updateLibraryStats() + this.updateLibraryStats() } if ( data.notify.includes('player') || data.notify.includes('options') || data.notify.includes('volume') ) { - vm.updatePlayerStatus() + this.updatePlayerStatus() } if (data.notify.includes('outputs') || data.notify.includes('volume')) { - vm.updateOutputs() + this.updateOutputs() } if (data.notify.includes('queue')) { - vm.updateQueue() + this.updateQueue() } if (data.notify.includes('spotify')) { - vm.updateSpotify() + this.updateSpotify() } if (data.notify.includes('lastfm')) { - vm.updateLastfm() + this.updateLastfm() } if (data.notify.includes('pairing')) { - vm.updatePairing() + this.updatePairing() } } }, @@ -302,7 +289,6 @@ export default { } }) } - }, - template: '' + } } diff --git a/web-src/src/components/ControlMainVolume.vue b/web-src/src/components/ControlMainVolume.vue index 4b15ddb8..0c92b0ba 100644 --- a/web-src/src/components/ControlMainVolume.vue +++ b/web-src/src/components/ControlMainVolume.vue @@ -47,7 +47,7 @@ export default { } }, methods: { - changeVolume(value) { + changeVolume() { webapi.player_volume(this.player.volume) }, toggle() { diff --git a/web-src/src/filter/index.js b/web-src/src/filter/index.js index eb6592fe..1d715545 100644 --- a/web-src/src/filter/index.js +++ b/web-src/src/filter/index.js @@ -26,7 +26,7 @@ export const filters = { minutes: Math.floor(seconds / 60) }).shiftTo(...unit) const filtered = Object.fromEntries( - Object.entries(shifted.toObject()).filter(([_, value]) => value > 0) + Object.entries(shifted.toObject()).filter(([, value]) => value > 0) ) return Duration.fromObject(filtered, { locale: locale.value }).toHuman() }, diff --git a/web-src/src/pages/PageQueue.vue b/web-src/src/pages/PageQueue.vue index 273fa703..c57f5c3e 100644 --- a/web-src/src/pages/PageQueue.vue +++ b/web-src/src/pages/PageQueue.vue @@ -150,7 +150,7 @@ export default { get() { return this.queueStore.items }, - set(value) { + set() { /* Do nothing? Send move request in @end event */ } } diff --git a/web-src/src/router/index.js b/web-src/src/router/index.js index 88ac6360..dd9d13b2 100644 --- a/web-src/src/router/index.js +++ b/web-src/src/router/index.js @@ -242,7 +242,7 @@ export const router = createRouter({ const delay = 0 if (savedPosition) { // Use the saved scroll position (browser back/forward navigation) - return new Promise((resolve, reject) => { + return new Promise((resolve) => { setTimeout(() => { resolve(savedPosition) }, delay) @@ -257,7 +257,7 @@ export const router = createRouter({ } if (to.hash) { // We are navigating to an anchor of a new page, add a timeout to let the transition effect finish before scrolling - return new Promise((resolve, reject) => { + return new Promise((resolve) => { setTimeout(() => { resolve({ el: to.hash, top: TOP_WITH_TABS }) }, delay) diff --git a/web-src/src/stores/queue.js b/web-src/src/stores/queue.js index 9060caaf..8c344f2d 100644 --- a/web-src/src/stores/queue.js +++ b/web-src/src/stores/queue.js @@ -14,7 +14,7 @@ export const useQueueStore = defineStore('QueueStore', { isPauseAllowed(state) { return state.current && state.current.data_kind !== 'pipe' }, - isSavingAllowed(state) { + isSavingAllowed() { const configuration = useConfigurationStore() return ( configuration.allow_modifying_stored_playlists && diff --git a/web-src/src/stores/settings.js b/web-src/src/stores/settings.js index 4a6a8398..58e9eb87 100644 --- a/web-src/src/stores/settings.js +++ b/web-src/src/stores/settings.js @@ -28,7 +28,7 @@ export const useSettingsStore = defineStore('SettingsStore', { } }, getters: { - locales(state) { + locales() { return availableLocales.map((item) => ({ id: item, name: t(`language.${item}`)