console/examples/progress-bar.ts

12 lines
327 B
TypeScript
Raw Normal View History

2025-03-14 20:24:43 -07:00
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;
}
});