Skip to content

realglobe-Inc/pon-task-cron

Repository files navigation

pon-task-cron

Build Status npm Version JS Standard

Cron task for pon

Installation

$ npm install pon-task-cron --save

Usage

'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))

Signatures

define(when, job, options) -> function

Define task

Param type Description
when string|Date When to invoke job
job function|string Job function or executable file
options Object Optional settings

License

This software is released under the Apache-2.0 License.

Links