MCPcopy Create free account
hub / github.com/echoVic/blade-code / simulate

Method simulate

src/ui/components/Progress.ts:136–153  ·  view source on GitHub ↗

* 模拟加载过程

(duration: number, message: string = '处理中')

Source from the content-addressed store, hash-verified

134 * 模拟加载过程
135 */
136 public static async simulate(duration: number, message: string = '处理中'): Promise<void> {
137 const steps = 20;
138 const stepDuration = duration / steps;
139
140 for (let i = 0; i <= steps; i++) {
141 const percentage = Math.round((i / steps) * 100);
142 const progress = this.createProgressBar(percentage);
143
144 process.stdout.write(`\r${message}: ${progress} ${percentage}%`);
145
146 if (i < steps) {
147 await new Promise(resolve => setTimeout(resolve, stepDuration));
148 }
149 }
150
151 process.stdout.write('\n');
152 UIDisplay.success('完成!');
153 }
154}
155
156/**

Callers

nothing calls this directly

Calls 2

createProgressBarMethod · 0.95
successMethod · 0.80

Tested by

no test coverage detected