Commit 84b918c
authored
Add method
Add method `spinner.message(_msg: string)` that can update message of spinner in progress.
use case:
```typescript
import * as p from "@clack/prompts";
p.intro("spinner start...");
const spin = p.spinner();
const total = 10000;
let progress = 0;
spin.start();
await new Promise((resolve) => {
const timer = setInterval(() => {
progress = Math.min(total, progress + 100);
if (progress >= total) {
clearInterval(timer);
resolve(true);
}
spin.message(`Loading packages [${progress}/${total}]`); // <===
}, 100);
});
spin.stop(`Done`);
p.outro("spinner stop...");
```spinner.message(_msg: string)
1 parent 593f93d commit 84b918c
1 file changed
+8
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
607 | 607 | | |
608 | 608 | | |
609 | 609 | | |
| 610 | + | |
610 | 611 | | |
611 | 612 | | |
612 | | - | |
613 | | - | |
| 613 | + | |
| 614 | + | |
614 | 615 | | |
615 | 616 | | |
616 | 617 | | |
| |||
627 | 628 | | |
628 | 629 | | |
629 | 630 | | |
630 | | - | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
631 | 636 | | |
632 | 637 | | |
633 | 638 | | |
| |||
0 commit comments