commit 7a2967b6d600f9e00366bf4bf468eb13df7d5efa
parent 5e30210d41733571eaa2653f50ecfc869faace89
Author: Leah (ctucx) <leah@ctu.cx>
Date: Sun, 7 Mar 2021 17:03:52 +0100
parent 5e30210d41733571eaa2653f50ecfc869faace89
Author: Leah (ctucx) <leah@ctu.cx>
Date: Sun, 7 Mar 2021 17:03:52 +0100
webmusic.js: use const for audioplayer and variable element in function playSong
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/webmusic.js b/webmusic.js @@ -1,12 +1,12 @@ 'use strict'; -let audioPlayer = new Audio(); -let selectedItem = 0; -let playingItem = 0; -let playerState = "idle"; -let continuous = true; -let repeat = false; -let total = 0; +const audioPlayer = new Audio(); +let selectedItem = 0; +let playingItem = 0; +let playerState = "idle"; +let continuous = true; +let repeat = false; +let total = 0; const handleKeyEvent = (event) => { switch (event.key) { @@ -148,7 +148,7 @@ const updateButtonState = () => { const playSong = (id) => { - let element = document.getElementById(id); + const element = document.getElementById(id); if (element === null) return; if (element.classList.contains('dir')) return;