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

Method countdown

src/ui/components/Progress.ts:114–131  ·  view source on GitHub ↗

* 倒计时

(seconds: number, message: string = '倒计时')

Source from the content-addressed store, hash-verified

112 * 倒计时
113 */
114 public static countdown(seconds: number, message: string = '倒计时'): Promise<void> {
115 return new Promise(resolve => {
116 let remaining = seconds;
117
118 const timer = setInterval(() => {
119 process.stdout.write(`\r${message}: ${UIStyles.status.warning(remaining.toString())}s `);
120
121 remaining--;
122
123 if (remaining < 0) {
124 clearInterval(timer);
125 process.stdout.write('\r');
126 UIDisplay.success('倒计时完成!');
127 resolve();
128 }
129 }, 1000);
130 });
131 }
132
133 /**
134 * 模拟加载过程

Callers

nothing calls this directly

Calls 2

warningMethod · 0.80
successMethod · 0.80

Tested by

no test coverage detected