aboutsummaryrefslogtreecommitdiff
path: root/src/services
diff options
context:
space:
mode:
authorRithwik Rayani <[email protected]>2022-03-19 20:33:08 +0530
committerGitHub <[email protected]>2022-03-19 10:03:08 -0500
commit46df0875d507ec8e7b1b268f1db5e7925d767d41 (patch)
tree56b4cb656329321bc86af55c4006f46a7be01ff5 /src/services
parent60376d4f5798004bc0215698bc1cc0786fcd5dbc (diff)
downloadmuse-46df0875d507ec8e7b1b268f1db5e7925d767d41.tar.xz
muse-46df0875d507ec8e7b1b268f1db5e7925d767d41.zip
added move command (#585)
Co-authored-by: Max Isom <[email protected]>
Diffstat (limited to 'src/services')
-rw-r--r--src/services/player.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/services/player.ts b/src/services/player.ts
index 020c501..5c38cdd 100644
--- a/src/services/player.ts
+++ b/src/services/player.ts
@@ -554,4 +554,14 @@ export default class {
resolve(returnedStream);
});
}
+
+ move(from: number, to: number): void {
+
+ if (from > this.queueSize() || to > this.queueSize()){
+ throw new Error('Move index is outside the range of the queue.' )
+ }
+
+ this.queue.splice( this.queuePosition + to ,0, this.queue.splice(this.queuePosition + from, 1)[0]);
+ }
+
}