node-schedule: Add support for object literal syntax. (#12445)

This commit is contained in:
Rand Scullard
2016-11-08 08:35:23 -05:00
committed by Masahiro Wakame
parent 732b0378d8
commit 9fbf2bbcd8

View File

@@ -214,6 +214,67 @@ export class RecurrenceRule {
nextInvocationDate(base:Date):Date;
}
/**
* Recurrence rule specification.
*/
export interface RecurrenceSpec {
/**
* Day of the month.
*
* @public
* @type {RecurrenceSegment}
*/
date?: RecurrenceSegment;
/**
* Day of the week.
*
* @public
* @type {RecurrenceSegment}
*/
dayOfWeek?: RecurrenceSegment;
/**
* Hour.
*
* @public
* @type {RecurrenceSegment}
*/
hour?: RecurrenceSegment;
/**
* Minute.
*
* @public
* @type {RecurrenceSegment}
*/
minute?: RecurrenceSegment;
/**
* Month.
*
* @public
* @type {RecurrenceSegment}
*/
month?: RecurrenceSegment;
/**
* Second.
*
* @public
* @type {RecurrenceSegment}
*/
second?: RecurrenceSegment;
/**
* Year.
*
* @public
* @type {RecurrenceSegment}
*/
year?: RecurrenceSegment;
}
/**
* Invocation.
*
@@ -266,11 +327,19 @@ export class Invocation {
/**
* Create a schedule job.
*
* @param {string|RecurrenceRule|Date} name either an optional name for the new Job or scheduling information
* @param {RecurrenceRule|Date|string} rule either the scheduling info or the JobCallback
* @param {JobCallback} callback The callback to be executed on each invocation.
* @param {string} name name for the new Job
* @param {RecurrenceRule|RecurrenceSpec|Date|string} rule scheduling info
* @param {JobCallback} callback callback to be executed on each invocation
*/
export function scheduleJob(name:string|RecurrenceRule|Date, rule: RecurrenceRule|Date|string|JobCallback, callback?: JobCallback): Job;
export function scheduleJob(name: string, rule: RecurrenceRule | RecurrenceSpec | Date | string, callback: JobCallback): Job;
/**
* Create a schedule job.
*
* @param {RecurrenceRule|RecurrenceSpec|Date|string} rule scheduling info
* @param {JobCallback} callback callback to be executed on each invocation
*/
export function scheduleJob(rule: RecurrenceRule | RecurrenceSpec | Date | string, callback: JobCallback): Job;
/**
* Changes the timing of a Job, canceling all pending invocations.
@@ -279,7 +348,7 @@ export class Invocation {
* @param spec {JobCallback} the new timing for this Job
* @return {Job} if the job could be rescheduled, {null} otherwise.
*/
export function rescheduleJob(job:Job|string, spec:RecurrenceRule|Date|string):Job;
export function rescheduleJob(job: Job | string, spec: RecurrenceRule | RecurrenceSpec | Date | string): Job;
/**
* Dictionary of all Jobs, accessible by name.