You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
497 B
JavaScript
21 lines
497 B
JavaScript
2 years ago
|
// SARS-CoV-2-Viz
|
||
|
// Animated COVID case count visualization
|
||
|
// Copyright 2022 Edward L. Platt <ed@elplatt.com>
|
||
|
|
||
|
function ProgressTracker(onCreate, onProgress) {
|
||
|
let jobProgress = [];
|
||
|
let tracker = {
|
||
|
getTracker: (initial='') => {
|
||
|
let id = jobProgress.length;
|
||
|
jobProgress.push(initial);
|
||
|
onCreate(id);
|
||
|
return (progress) => {
|
||
|
jobProgress[id] = progress;
|
||
|
onProgress(id, tracker.progress(id));
|
||
|
}
|
||
|
},
|
||
|
progress: (id) => jobProgress[id]
|
||
|
};
|
||
|
return tracker;
|
||
|
}
|