mirror of
https://codeberg.org/Hyperpipe/Hyperpipe
synced 2025-06-29 13:28:02 +02:00
Changes:
- Removing Local playlists and playlist items - Unsubscribe from feeds - Closes #56 - Closes #85
This commit is contained in:
parent
affb0e33f6
commit
7cc847146d
7 changed files with 94 additions and 36 deletions
|
@ -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'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue