@ronmu/crontab
v1.0.1-20240805-1813.0
Published
定时任务 ## 安装使用 ```bash npm install @ronmu/crontab
Downloads
4
Readme
@ronmu/crontab
定时任务
安装使用
npm install @ronmu/crontab
pnpm install @ronmu/crontab
例子代码
const text = "*/1 * * * * *";
function onTick(): void {
console.log(`${new Date().toJSON()}`)
}
const CRON = CRONTAB.getInstance(text, onTick, null, '', null, true);
CRON.start();
console.log(`
CRONTAB 启动于: ${new Date().toJSON()},
接下来 10 次:
${(CRON.nextDates(10)).map((x) => x.toJSON()).join('\n')}
`)