node Later定时任务
Posted 都市烟火
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了node Later定时任务相关的知识,希望对你有一定的参考价值。
var later = require(‘later‘); later.date.localTime(); var basic = {h: [15], m: [40], s: [0]}; var composite = [ basic ]; var sched = { schedules: composite }; // 列举接下来10次触发的时间 var occurrences = later.schedule(sched).next(10); for (var i = 0; i < 10; i++) { console.log(occurrences[i]); } // execute logTime one time on the next occurrence of the text schedule var timer = later.setInterval(logTime, sched); //var timer = later.setTimeout(logTime, sched); // function to execute function logTime() { console.log("AAAAAAAAAAAAAAAAAAAAAAA"); console.log(new Date()); console.log("EEEEEEEEEEEEEEEEEEEEEEE"); }
http://bunkat.github.io/later/schedules.html
http://blog.fens.me/nodejs-cron-later/
以上是关于node Later定时任务的主要内容,如果未能解决你的问题,请参考以下文章
定时器setTimeout()和Node.js的Event Loop