MCPcopy Create free account
hub / github.com/6dylan6/jdpro / countdown

Method countdown

function/magic.js:581–610  ·  view source on GitHub ↗
(mode = 1, s = 200)

Source from the content-addressed store, hash-verified

579 }
580
581 async countdown(mode = 1, s = 200) {
582 let d = new Date();
583 switch (mode) {
584 case 1:
585 d.setHours(d.getHours() + 1);
586 d.setMinutes(0)
587 break
588 case 2:
589 d.setMinutes(30)
590 break
591 case 3:
592 d.setMinutes(15)
593 break
594 case 4:
595 d.setMinutes(10)
596 break
597 case 5:
598 d.setMinutes(5)
599 break
600 default:
601 console.log("不支持")
602 }
603 d.setSeconds(0)
604 d.setMilliseconds(0)
605 let st = d.getTime() - Date.now() - 200
606 if (st > 0) {
607 console.log(`需要等待时间${st / 1000} 秒`);
608 await this.wait(st)
609 }
610 }
611
612 readFileSync(path) {
613 try {

Callers

nothing calls this directly

Calls 3

waitMethod · 0.95
nowMethod · 0.80
logMethod · 0.45

Tested by

no test coverage detected