console/examples/progress-bar.ts

11 lines
313 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;
}
});