MCPcopy
hub / github.com/nukeop/nuclear / createQueueHost

Function createQueueHost

packages/player/src/services/queueHost.ts:10–95  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8import { useQueueStore } from '../stores/queueStore';
9
10export const createQueueHost = (): QueueHost => {
11 return {
12 getQueue: async () => {
13 const state = useQueueStore.getState();
14 return {
15 items: state.items,
16 currentIndex: state.currentIndex,
17 };
18 },
19
20 getCurrentItem: async () => {
21 return useQueueStore.getState().getCurrentItem();
22 },
23
24 addToQueue: async (tracks: Track[]) => {
25 useQueueStore.getState().addToQueue(tracks);
26 },
27
28 addNext: async (tracks: Track[]) => {
29 useQueueStore.getState().addNext(tracks);
30 },
31
32 addAt: async (tracks: Track[], index: number) => {
33 useQueueStore.getState().addAt(tracks, index);
34 },
35
36 removeByIds: async (ids: string[]) => {
37 useQueueStore.getState().removeByIds(ids);
38 },
39
40 removeByIndices: async (indices: number[]) => {
41 useQueueStore.getState().removeByIndices(indices);
42 },
43
44 clearQueue: async () => {
45 useQueueStore.getState().clearQueue();
46 },
47
48 reorder: async (fromIndex: number, toIndex: number) => {
49 useQueueStore.getState().reorder(fromIndex, toIndex);
50 },
51
52 updateItemState: async (id: string, updates: QueueItemStateUpdate) => {
53 useQueueStore.getState().updateItemState(id, updates);
54 },
55
56 goToNext: async () => {
57 useQueueStore.getState().goToNext();
58 },
59
60 goToPrevious: async () => {
61 useQueueStore.getState().goToPrevious();
62 },
63
64 goToIndex: async (index: number) => {
65 useQueueStore.getState().goToIndex(index);
66 },
67

Callers 1

queueHost.tsFile · 0.85

Calls 15

getStateMethod · 0.80
getCurrentItemMethod · 0.80
addToQueueMethod · 0.80
addNextMethod · 0.80
addAtMethod · 0.80
removeByIdsMethod · 0.80
removeByIndicesMethod · 0.80
clearQueueMethod · 0.80
reorderMethod · 0.80
updateItemStateMethod · 0.80
goToNextMethod · 0.80
goToPreviousMethod · 0.80

Tested by

no test coverage detected