Skip to content

Commit

Permalink
Re-init download button in case of error
Browse files Browse the repository at this point in the history
  • Loading branch information
th-ch committed Nov 22, 2020
1 parent 2937db3 commit 4d4aadf
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions plugins/downloader/front.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ const observer = new MutationObserver((mutations, observer) => {
}
});

const reinit = () => {
if (!progress) {
console.warn("Cannot update progress");
} else {
progress.innerHTML = "Download";
}
};

global.download = () => {
const videoUrl = window.location.href;

Expand All @@ -33,14 +41,9 @@ global.download = () => {
},
(error) => {
triggerAction(CHANNEL, ACTIONS.ERROR, error);
reinit();
},
() => {
if (!progress) {
console.warn("Cannot update progress");
} else {
progress.innerHTML = "Download";
}
}
reinit
);
};

Expand Down

0 comments on commit 4d4aadf

Please sign in to comment.