npm install think-crontabsrc/config/crontab.js,
``js`
module.exports = [{
interval: '10s',
immediate: true,
handle: () => {
//do something
}
}, {
cron: '0 /1 ',
handle: 'crontab/test',
worker: 'all'
}]
* interval {String|Number} interval taskcron
* {String} cron taskworker
{String} task type, one/all*, default is onehandle
* {Function|String} task handle, requiredimmediate
* {Boolean} immediate to run task, default is falseenable` {Boolean} enable task, default is true
*