« get me outta code hell

immediately show results of acting on queue player - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2020-02-04 21:53:48 -0400
committerFlorrie <towerofnix@gmail.com>2020-02-04 21:53:48 -0400
commitc2893e7709d51c232b6a6c868bd2fa452d6f5932 (patch)
tree12ac3fa51f8e06985edeecb8067fc1b711d649db
parent3789eab2f1322206011e89fa5e1f4afeacad0099 (diff)
immediately show results of acting on queue player
Specifically, this makes toggling loop show its effect right away.
-rw-r--r--ui.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/ui.js b/ui.js
index 9dba6d6..81108aa 100644
--- a/ui.js
+++ b/ui.js
@@ -947,12 +947,13 @@ class AppElement extends FocusElement {
   }
 
   actOnQueuePlayers(fn) {
-    if (this.queuePlayersToActOn.length) {
-      for (const queuePlayer of this.queuePlayersToActOn) {
-        fn(queuePlayer)
+    const actOn = this.queuePlayersToActOn.length ? this.queuePlayersToActOn : [this.SQP]
+    for (const queuePlayer of actOn) {
+      fn(queuePlayer)
+      const PIE = this.getPlaybackInfoElementForQueuePlayer(queuePlayer)
+      if (PIE) {
+        PIE.updateProgress()
       }
-    } else {
-      fn(this.SQP)
     }
   }