- Removing Local playlists and playlist items
- Unsubscribe from feeds
- Closes #56
- Closes #85
This commit is contained in:
Shiny Nematoda 2022-12-31 19:23:14 +00:00
parent affb0e33f6
commit 7cc847146d
7 changed files with 94 additions and 36 deletions

View file

@ -40,7 +40,8 @@ export function useUpdatePlaylist(key, obj, cb = () => null) {
const itm = e.target.result;
if (itm) {
itm.urls.push(obj);
if ('number' == typeof obj) itm.urls.splice(obj, 1);
else if ('object' == typeof obj) itm.urls.push(obj);
store.put(itm);
cb(true);
}
@ -77,6 +78,23 @@ export function useCreatePlaylist(key, obj, cb = () => null) {
} else alert('No indexedDB Created');
}
export function useRemovePlaylist(key, cb = () => null) {
if (window.db && key) {
const store = window.db
.transaction(['playlist'], 'readwrite')
.objectStore('playlist'),
req = store.delete(key);
req.onerror = e => {
console.error('Error removing playlist ', e);
};
req.onsuccess = () => {
cb();
};
}
}
export function useGetPlaylist(key, cb = () => null) {
if (window.db && key) {
const store = window.db.transaction(['playlist']).objectStore('playlist'),