« get me outta code hell

Add comment explaining what hasOpenedPlaylist does - http-music - Command-line music player + utils (not a server!)
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-02-22 01:46:05 -0400
committerFlorrie <towerofnix@gmail.com>2018-02-22 01:46:06 -0400
commitee1fb8297bbd71faa51985556232bb75cae11274 (patch)
tree7a1b1a93d1e7e1707cfff9a4183fbe357478e17d /src
parent0c3ded953b9d2a5b127d62f2fccdc3b4658f6c7b (diff)
Add comment explaining what hasOpenedPlaylist does
I can totally see myself forgetting what on earth the variable exists
for without this documentation.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/play.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/play.js b/src/play.js
index b049a0d..d54004a 100755
--- a/src/play.js
+++ b/src/play.js
@@ -93,6 +93,16 @@ async function main(args) {
   // The file to output the playlist path to the current file.
   let trackDisplayFile
 
+  // Whether or not a playlist has been opened yet. This is just used to
+  // decide when exactly to load the default playlist. (We don't want to load
+  // it as soon as the process starts, since there might be an --open-playlist
+  // option that specifies opening a *different* playlist! But if we encounter
+  // an action that requires a playlist, and no playlist has yet been opened,
+  // we assume that the user probably wants to do something with the default
+  // playlist, and that's when we open it. See requiresOpenPlaylist for the
+  // implementation of this.)
+  let hasOpenedPlaylist = false
+
   const keybindings = [
     [['space'], 'togglePause'],
     [['left'], 'seek', -5],
@@ -187,8 +197,6 @@ async function main(args) {
     keybindings.unshift(...openedKeybindings)
   }
 
-  let hasOpenedPlaylist = false
-
   async function requiresOpenPlaylist() {
     if (activePlaylist === null) {
       if (hasOpenedPlaylist === false) {