1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2025-07-19 22:18:03 +00:00

Improvements to progress dialogs

This commit is contained in:
2023-05-27 17:52:51 +02:00
parent 167c3bddb6
commit ab1891be27
3 changed files with 25 additions and 4 deletions

View File

@ -4,12 +4,23 @@ let taskCounter = 0;
export function startProgress(taskDescription = 'Loading…') {
const taskIndex = ++taskCounter;
StartProgressBar(taskIndex, taskDescription);
let started = false;
const debouncer = setTimeout(() => {
StartProgressBar(taskIndex, taskDescription);
started = true;
}, 150);
const task = {
id: taskIndex,
description: taskDescription,
end: () => StopProgressBar(taskIndex),
end: () => {
clearTimeout(debouncer);
if (started) {
StopProgressBar(taskIndex);
}
},
};
return task;