Cron task for pon
$ npm install pon-task-cron --save
'use strict'
const pon = require('pon')
const ponTaskCron = require('pon-task-cron')
;(async () => {
let run = pon({
// Define job with crone time
'job:01': ponTaskCron('42 * * * *', () => {
console.log('Hey! A hour passed')
}),
// Specifying by date
'job:02': ponTaskCron(new Date('2020/01/12'), () => { /* ... */ })
})
run('job:*')
}).catch((err) => console.error(err))
Define task
Param | type | Description |
---|---|---|
when | string|Date | When to invoke job |
job | function|string | Job function or executable file |
options | Object | Optional settings |
This software is released under the Apache-2.0 License.