jmurphy
Well-known member
Some of the processes in PhotometricMosaic need to provide progress feedback to the user.
My current solution:
This works, but it is slow. I have therefore had to limit it to showing increments of 5%.
Is there a better way of doing this?
Thanks
John Murphy
My current solution:
JavaScript:
let lastProgressPc;
function progressCallback(count, total){
if (count === 0){
console.write("<end> 0%");
lastProgressPc = 0;
processEvents();
} else {
let pc = Math.round(100 * count / total);
if (pc > lastProgressPc && (pc > lastProgressPc + 5 || pc === 100)){
console.write(format("\b\b\b\b%3d%%", pc));
lastProgressPc = pc;
processEvents();
}
}
}
This works, but it is slow. I have therefore had to limit it to showing increments of 5%.
Is there a better way of doing this?
Thanks
John Murphy