| 210 | } |
| 211 | |
| 212 | update(processedCount: number): void { |
| 213 | if (this.totalItems === 0 || this.stopped) return |
| 214 | |
| 215 | this.processedItems = Math.min(processedCount, this.totalItems) |
| 216 | if (this.processedItems >= this.totalItems) { |
| 217 | this.stop() // Automatically stop if all items are processed |
| 218 | return |
| 219 | } |
| 220 | if (canRewriteStdoutLine()) this.render() // Re-render on each item processed for immediate feedback |
| 221 | } |
| 222 | |
| 223 | private render(final = false): void { |
| 224 | if (this.totalItems === 0 && this.processedItems === 0 && !this.startTime) |