mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-05-09 19:51:36 +02:00
Fix Queue.removeCurrent()
This commit is contained in:
parent
7f39642c49
commit
3de34e5e4a
2 changed files with 2 additions and 5 deletions
|
@ -57,6 +57,7 @@ export default class {
|
||||||
queue.removeCurrent();
|
queue.removeCurrent();
|
||||||
|
|
||||||
if (isPlaying) {
|
if (isPlaying) {
|
||||||
|
queue.back();
|
||||||
await player.seek(oldPosition);
|
await player.seek(oldPosition);
|
||||||
} else {
|
} else {
|
||||||
player.disconnect();
|
player.disconnect();
|
||||||
|
|
|
@ -19,7 +19,7 @@ export default class {
|
||||||
private position = 0;
|
private position = 0;
|
||||||
|
|
||||||
forward(): void {
|
forward(): void {
|
||||||
if (this.position <= this.size() + 1) {
|
if (this.position < this.size() + 1) {
|
||||||
this.position++;
|
this.position++;
|
||||||
} else {
|
} else {
|
||||||
throw new Error('No songs in queue to forward to.');
|
throw new Error('No songs in queue to forward to.');
|
||||||
|
@ -85,10 +85,6 @@ export default class {
|
||||||
|
|
||||||
removeCurrent(): void {
|
removeCurrent(): void {
|
||||||
this.queue = [...this.queue.slice(0, this.position), ...this.queue.slice(this.position + 1)];
|
this.queue = [...this.queue.slice(0, this.position), ...this.queue.slice(this.position + 1)];
|
||||||
|
|
||||||
if (this.position !== 0) {
|
|
||||||
this.position--;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size(): number {
|
size(): number {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue