49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import QM from "../queueManager";
|
|
import {ProcessingQueue, Queue, QueueItem} from "../types/queue";
|
|
|
|
export function list(): Queue {
|
|
return QM.getQueue();
|
|
}
|
|
|
|
export function get(index: number): QueueItem {
|
|
return QM.get(index);
|
|
}
|
|
|
|
export async function add(song: string): Promise<QueueItem> {
|
|
return await QM.add(song);
|
|
}
|
|
|
|
export async function insertAt(song: string, index: number): Promise<QueueItem> {
|
|
return await QM.insertAt(song, index);
|
|
}
|
|
|
|
export async function remove(song: string): Promise<QueueItem> {
|
|
return await QM.remove(song);
|
|
}
|
|
|
|
export function clear(): void {
|
|
QM.clear();
|
|
}
|
|
|
|
/**
|
|
* Moves an item from one index to another.
|
|
* @param song the song to move
|
|
* @param to the index to move the song to.
|
|
* If an item already exists at this index, the song will be inserted before it.
|
|
* If the index is out of bounds, the song will be moved to the end of the queue.
|
|
*/
|
|
export function move(song: string, to: number): void {
|
|
QM.move(song, to);
|
|
}
|
|
|
|
export function retry(song: string): void {
|
|
QM.retry(song);
|
|
}
|
|
|
|
export function processing(): ProcessingQueue {
|
|
return QM.getProcessing();
|
|
}
|
|
|
|
export function history(): Queue {
|
|
return QM.getHistory();
|
|
}
|