Skip to content
This repository has been archived by the owner on Feb 25, 2023. It is now read-only.

Commit

Permalink
fix: auto start download file when resumed window
Browse files Browse the repository at this point in the history
  • Loading branch information
dotennin committed Jun 27, 2020
1 parent 123055d commit 76b4ce2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion public/bundle.user.js
Expand Up @@ -736,7 +736,6 @@ async function downloadItem(arr) {
await getDownloadUrl(arr);
}
arr.status = types_1.StatusTypes.downloading;
_1.renderOperationElement(arr);
InstaceForSystem_1.InstanceForSystem.downloadingItems[arr.fs_id] = arr;
const { url, server_filename } = arr;
let loaded = 0;
Expand Down Expand Up @@ -790,6 +789,9 @@ async function downloadItem(arr) {
addNextDownloadRequest();
},
});
window.requestAnimationFrame(() => {
_1.renderOperationElement(arr);
});
arr.progress_loader_id = window.setInterval(() => {
if (currentEvent) {
const speed = currentEvent.loaded - loaded;
Expand Down
4 changes: 3 additions & 1 deletion src/apis.ts
Expand Up @@ -49,7 +49,6 @@ export async function downloadItem(arr: IItem) {
}

arr.status = StatusTypes.downloading
renderOperationElement(arr)

InstanceForSystem.downloadingItems[arr.fs_id] = arr
const { url, server_filename } = arr
Expand Down Expand Up @@ -109,6 +108,9 @@ export async function downloadItem(arr: IItem) {
addNextDownloadRequest()
},
})
window.requestAnimationFrame(() => {
renderOperationElement(arr)
})

arr.progress_loader_id = window.setInterval(() => {
if (currentEvent) {
Expand Down

0 comments on commit 76b4ce2

Please sign in to comment.