summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeah (ctucx) <leah@ctu.cx>2021-03-07 17:06:50 +0100
committerLeah (ctucx) <leah@ctu.cx>2021-03-07 17:06:50 +0100
commit63b1fa60189977d6b6ab643d19ec875fbcbf7f8f (patch)
tree309f7ad9f3081bc4066aca649735b644a2bfcb7f
parent7a2967b6d600f9e00366bf4bf468eb13df7d5efa (diff)
downloadwebmusic-nginx-63b1fa60189977d6b6ab643d19ec875fbcbf7f8f.tar.gz
webmusic-nginx-63b1fa60189977d6b6ab643d19ec875fbcbf7f8f.tar.bz2
webmusic-nginx-63b1fa60189977d6b6ab643d19ec875fbcbf7f8f.zip
use arrow functions everywhere
-rw-r--r--webmusic.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/webmusic.js b/webmusic.js
index 165dbdc..3da097c 100644
--- 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);