commit 63b1fa60189977d6b6ab643d19ec875fbcbf7f8f
parent 7a2967b6d600f9e00366bf4bf468eb13df7d5efa
Author: Leah (ctucx) <leah@ctu.cx>
Date: Sun, 7 Mar 2021 17:06:50 +0100
parent 7a2967b6d600f9e00366bf4bf468eb13df7d5efa
Author: Leah (ctucx) <leah@ctu.cx>
Date: Sun, 7 Mar 2021 17:06:50 +0100
use arrow functions everywhere
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/webmusic.js b/webmusic.js @@ -70,39 +70,39 @@ const initState = () => { document.getElementById("repeatButton").addEventListener("click", toggleRepeat) document.getElementById("continuousButton").addEventListener("click", toggleContinue) - audioPlayer.addEventListener("canplay", function () { + audioPlayer.addEventListener("canplay", () => { audioPlayer.play(); }); - audioPlayer.addEventListener("play", function () { + audioPlayer.addEventListener("play", () => { setPlayerState("playing"); }); - audioPlayer.addEventListener("pause", function () { + audioPlayer.addEventListener("pause", () => { setPlayerState("paused"); }); - audioPlayer.addEventListener("error", function () { + audioPlayer.addEventListener("error", () => { setPlayerState("error loading track"); }); - audioPlayer.addEventListener("ended", function () { + audioPlayer.addEventListener("ended", () => { setPlayerState("idle"); nextTrack(); }); - audioPlayer.addEventListener("timeupdate", function () { + audioPlayer.addEventListener("timeupdate", () => { updatePlayerState(); }); - dirElements.forEach(function(element){ + dirElements.forEach((element) => { element.id = id++; }); - fileElements.forEach(function(element){ + fileElements.forEach((element) => { element.id = id++; - element.addEventListener("click", function(event) { + element.addEventListener("click", (event) => { event.preventDefault(); event.stopPropagation(); playSong(event.target.id);