12 lines
327 B
TypeScript
12 lines
327 B
TypeScript
|
import { withProgress } from "@paperclover/console/Progress";
|
||
|
|
||
|
await withProgress('do a task', async (progress) => {
|
||
|
// mutate the progress object
|
||
|
progress.total = 100;
|
||
|
|
||
|
for (let i = 0; i < progress.total; i++) {
|
||
|
await new Promise(resolve => setTimeout(resolve, 10));
|
||
|
progress.value += 1;
|
||
|
}
|
||
|
});
|