mirror of
https://github.com/movie-web/movie-web.git
synced 2025-01-14 13:09:31 +01:00
Add methods to directly set progress and bookmark items
This commit is contained in:
parent
558c6431fd
commit
a642abc783
@ -26,6 +26,7 @@ export interface BookmarkStore {
|
|||||||
bookmarks: Record<string, BookmarkMediaItem>;
|
bookmarks: Record<string, BookmarkMediaItem>;
|
||||||
updateQueue: BookmarkUpdateItem[];
|
updateQueue: BookmarkUpdateItem[];
|
||||||
addBookmark(meta: PlayerMeta): void;
|
addBookmark(meta: PlayerMeta): void;
|
||||||
|
setBookmark(id: string, item: BookmarkMediaItem): void;
|
||||||
removeBookmark(id: string): void;
|
removeBookmark(id: string): void;
|
||||||
replaceBookmarks(items: Record<string, BookmarkMediaItem>): void;
|
replaceBookmarks(items: Record<string, BookmarkMediaItem>): void;
|
||||||
clear(): void;
|
clear(): void;
|
||||||
@ -94,6 +95,11 @@ export const useBookmarkStore = create(
|
|||||||
s.updateQueue = [...s.updateQueue.filter((v) => v.id !== id)];
|
s.updateQueue = [...s.updateQueue.filter((v) => v.id !== id)];
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
setBookmark(id, item) {
|
||||||
|
set((s) => {
|
||||||
|
s.bookmarks[id] = item;
|
||||||
|
});
|
||||||
|
},
|
||||||
})),
|
})),
|
||||||
{
|
{
|
||||||
name: "__MW::bookmarks",
|
name: "__MW::bookmarks",
|
||||||
|
@ -64,6 +64,7 @@ export interface ProgressStore {
|
|||||||
clear(): void;
|
clear(): void;
|
||||||
clearUpdateQueue(): void;
|
clearUpdateQueue(): void;
|
||||||
removeUpdateItem(id: string): void;
|
removeUpdateItem(id: string): void;
|
||||||
|
setItem(id: string, item: ProgressMediaItem): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
let updateId = 0;
|
let updateId = 0;
|
||||||
@ -173,6 +174,11 @@ export const useProgressStore = create(
|
|||||||
s.updateQueue = [...s.updateQueue.filter((v) => v.id !== id)];
|
s.updateQueue = [...s.updateQueue.filter((v) => v.id !== id)];
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
setItem(id, item) {
|
||||||
|
set((s) => {
|
||||||
|
s.items[id] = item;
|
||||||
|
});
|
||||||
|
},
|
||||||
})),
|
})),
|
||||||
{
|
{
|
||||||
name: "__MW::progress",
|
name: "__MW::progress",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user