mirror of
https://github.com/ragestudio/relic.git
synced 2025-06-09 02:24:18 +00:00
move function to fix download
This commit is contained in:
parent
98b6740839
commit
6287f5fa50
@ -47,18 +47,17 @@ export default async function downloadTorrent(
|
||||
},
|
||||
)
|
||||
|
||||
async function stopDownload() {
|
||||
await client.call("remove", downloadId)
|
||||
clearInterval(progressInterval)
|
||||
}
|
||||
|
||||
await new Promise(async (resolve, reject) => {
|
||||
if (typeof onStart === "function") {
|
||||
onStart()
|
||||
}
|
||||
|
||||
async function stopDownload() {
|
||||
await client.call("remove", downloadId)
|
||||
clearInterval(progressInterval)
|
||||
}
|
||||
|
||||
if (taskId) {
|
||||
// TODO: Unregister me when download finish
|
||||
global._relic_eventBus.once(`task:cancel:${taskId}`, stopDownload)
|
||||
}
|
||||
|
||||
@ -137,6 +136,5 @@ export default async function downloadTorrent(
|
||||
global._relic_eventBus.off(`task:cancel:${taskId}`, stopDownload)
|
||||
}
|
||||
|
||||
|
||||
return downloadId
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user