UNPKG

cronosjs-extended

Version:

A cron based task scheduler for node and the browser, with extended syntax and timezone support.

18 lines (17 loc) 619 B
import { CronosExpression } from "./expression"; import { CronosTask, refreshSchedulerTimer } from "./scheduler"; import { CronosTimezone } from "./date"; export function scheduleTask(cronString, task, options) { const expression = CronosExpression.parse(cronString, options); return new CronosTask(expression).on("run", task).start(); } export function validate(cronString, options) { try { CronosExpression.parse(cronString, options); } catch { return false; } return true; } export { CronosExpression, CronosTask, CronosTimezone, refreshSchedulerTimer };