changed default polling interval to 1.5s;added wrapper function for polling youtube downloads

This commit is contained in:
huangjx
2022-04-24 14:00:46 +08:00
parent 1cf4f4a00b
commit 0a9bcb606d
3 changed files with 15 additions and 12 deletions

View File

@@ -11,9 +11,6 @@ export default {
let container = document.querySelector(tableContainer);
let currentType = container.getAttribute("type");
let path = basePath + type;
if (type === "youtube-dl") {
path = "/apps/ncdownloader/youtube/get";
}
let name = type + "-downloads";
//avoid repeated click
if (currentType === name && helper.isPolling()) {
@@ -21,11 +18,15 @@ export default {
}
container.setAttribute("type", name);
container.className = "table " + name;
let delay = 15000;
if (['active', 'youtube-dl'].includes(type)) {
delay = 1500;
let delay;
if (!['active', 'youtube-dl'].includes(type)) {
delay = 15000;
}
if (type === "youtube-dl") {
helper.pollingYoutube();
} else {
helper.polling(delay, path);
}
helper.polling(delay, path);
};
eventHandler.add("click", ".waiting-downloads a", event => clickHandler(event, 'waiting'));
eventHandler.add("click", ".complete-downloads a", event => clickHandler(event, 'complete'));