|
|
@ -10,7 +10,7 @@ import { notification } from "./notification";
|
|
|
|
class TaskDispatcher {
|
|
|
|
class TaskDispatcher {
|
|
|
|
private running: boolean;
|
|
|
|
private running: boolean;
|
|
|
|
private tasks: Record<string, Task.Callable[]> = {};
|
|
|
|
private tasks: Record<string, Task.Callable[]> = {};
|
|
|
|
private progress: Record<string, Site.Progress> = {};
|
|
|
|
private progress: Record<string, boolean> = {};
|
|
|
|
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
constructor() {
|
|
|
|
this.running = false;
|
|
|
|
this.running = false;
|
|
|
@ -110,10 +110,10 @@ class TaskDispatcher {
|
|
|
|
// TODO: FIX ME!
|
|
|
|
// TODO: FIX ME!
|
|
|
|
item.value += 1;
|
|
|
|
item.value += 1;
|
|
|
|
|
|
|
|
|
|
|
|
if (item.value >= item.count && this.progress[item.id] !== undefined) {
|
|
|
|
if (item.value >= item.count && this.progress[item.id]) {
|
|
|
|
updateNotification(notification.progress.end(item.id, item.header));
|
|
|
|
updateNotification(notification.progress.end(item.id, item.header));
|
|
|
|
delete this.progress[item.id];
|
|
|
|
delete this.progress[item.id];
|
|
|
|
} else if (item.value > 1 && this.progress[item.id] !== undefined) {
|
|
|
|
} else if (item.value > 1 && this.progress[item.id]) {
|
|
|
|
updateNotification(
|
|
|
|
updateNotification(
|
|
|
|
notification.progress.update(
|
|
|
|
notification.progress.update(
|
|
|
|
item.id,
|
|
|
|
item.id,
|
|
|
@ -123,10 +123,10 @@ class TaskDispatcher {
|
|
|
|
item.count
|
|
|
|
item.count
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
} else if (item.value > 1 && this.progress[item.id] === undefined) {
|
|
|
|
showNotification(notification.progress.pending(item.id, item.header));
|
|
|
|
showNotification(notification.progress.pending(item.id, item.header));
|
|
|
|
this.progress[item.id] = item;
|
|
|
|
this.progress[item.id] = true;
|
|
|
|
setTimeout(() => this.updateProgress(items), 1000);
|
|
|
|
setTimeout(() => this.updateProgress([item]), 1000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|