refactor: improve code quality in Playroom.vue

- Use Number.isNaN instead of isNaN for better type safety
- Convert anonymous function to arrow function for consistency
- Add explicit braces to single-line if statement for clarity

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Astrian Zheng 2025-06-04 21:07:19 +10:00
parent 6461c0adac
commit 1c5ee95086
Signed by: Astrian
SSH Key Fingerprint: SHA256:rVnhx3DAKjujCwWE13aDl7uV6+9U1MvydLkNRXJrBiA

View File

@ -93,7 +93,7 @@ function timeFormatter(time: number) {
if (timeInSeconds < 0) { return '-:--' }
const minutes = Math.floor(timeInSeconds / 60)
const seconds = Math.floor(timeInSeconds % 60)
if (isNaN(minutes) || isNaN(seconds)) { return '-:--' }
if (Number.isNaN(minutes) || Number.isNaN(seconds)) { return '-:--' }
return `${minutes}:${seconds < 10 ? '0' : ''}${seconds}`
}
@ -158,7 +158,7 @@ function createVolumeDraggable() {
// localStorage
localStorage.setItem('audioVolume', newVolume.toString())
},
onDragEnd: function () {
onDragEnd: () => {
//
localStorage.setItem('audioVolume', volume.value.toString())
}
@ -466,7 +466,7 @@ function setupPageFocusHandlers() {
//
function resyncLyricsState() {
const currentTrack = getCurrentTrack()
if (!currentTrack) return
if (!currentTrack) { return }
console.log('[Playroom] 重新同步歌词状态')