summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah (ctucx) <leah@ctu.cx>2021-03-07 15:16:55 +0100
committerLeah (ctucx) <leah@ctu.cx>2021-03-07 15:16:55 +0100
commitb246cd3ff4d02e8e26fe2b9c12f95fa54336cc9b (patch)
tree89735e7020ff21192ff04001ad9ad5e8daa933c8
parent45ca1f6338945691e7eda94873a2e546f374321d (diff)
webmusic.js: renamed setState to setPlayerState and updateState to updatePlayerState
-rw-r--r--webmusic.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/webmusic.js b/webmusic.js
index c6d572e..7f95891 100644
--- a/webmusic.js
+++ b/webmusic.js
@@ -78,18 +78,18 @@ const initState = () => {
});
total = id;
- updateState();
+ updatePlayerState();
updateButtonState();
}
-const setState = (state) => {
+const setPlayerState = (state) => {
gstate = state;
console.log("now in state: " + state);
- updateState();
+ updatePlayerState();
}
-const updateState = () => {
+const updatePlayerState = () => {
let statestr = "[" + gstate;
if (!audioPlayer.paused) {
@@ -130,7 +130,7 @@ const playSong = (id) => {
audioPlayer.pause()
audioPlayer.src = element.href;
- setState("loading");
+ setPlayerState("loading");
audioPlayer.load();
audioPlayer.loop = repeat;
@@ -142,24 +142,24 @@ const playSong = (id) => {
});
audioPlayer.addEventListener("play", function () {
- setState("playing");
+ setPlayerState("playing");
});
audioPlayer.addEventListener("pause", function () {
- setState("paused");
+ setPlayerState("paused");
});
audioPlayer.addEventListener("error", function () {
- setState("error loading track");
+ setPlayerState("error loading track");
});
audioPlayer.addEventListener("ended", function () {
- setState("idle");
+ setPlayerState("idle");
nextTrack();
});
audioPlayer.addEventListener("timeupdate", function () {
- updateState();
+ updatePlayerState();
});
}