mirror of
https://github.com/moku-project/Moku.git
synced 2026-06-14 01:39:56 -05:00
Chore: Restructure Repository for SvelteKit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { getAdapter } from '$lib/request-manager'
|
||||
import { downloadsState } from '$lib/state/downloads.svelte'
|
||||
|
||||
export async function loadDownloads() {
|
||||
try {
|
||||
downloadsState.items = await getAdapter().getDownloads()
|
||||
} catch (e) {
|
||||
downloadsState.error = String(e)
|
||||
}
|
||||
}
|
||||
|
||||
export async function enqueueDownload(chapterId: string) {
|
||||
await getAdapter().enqueueDownload(chapterId)
|
||||
await loadDownloads()
|
||||
}
|
||||
|
||||
export async function dequeueDownload(chapterId: string) {
|
||||
await getAdapter().dequeueDownload(chapterId)
|
||||
downloadsState.items = downloadsState.items.filter(d => d.chapterId !== chapterId)
|
||||
}
|
||||
|
||||
export async function clearDownloads() {
|
||||
await getAdapter().clearDownloads()
|
||||
downloadsState.items = []
|
||||
}
|
||||
Reference in New Issue
Block a user