UNPKG

node-cron-management

Version:
62 lines (61 loc) 1.71 kB
export declare class CronManager { private instanceMap; private handlerTagCronJobMap; private groupTagCronJobMap; private allJobs; private initialized; constructor(); /** * Registers an instance to a class * @param Class : The Class * @param instance : Instance of the class given */ register(Class: Function, instance: any): void; /** * gets all the handlers and adds them to the various Maps and lists in the appropriate manner * @returns void */ private init; /** * starts all cron jobs */ startAll(): void; /** * stops all cron jobs */ stopAll(): void; /** * starts or stops all jobs defined in a group with groupTag = groupTag * @param groupTag : unique tag of the group * @param start : set to true to start the job. Set to false to stop the job. it defaults to true if not set. */ private startGroupLogic; /** * * @param handlerTag unique tag of the handler * @param start set to true to start the job. Set to false to stop the job. it defaults to true if not set. */ private startHandlerLogic; /** * Starts all jobs with groupTag * @param groupTag */ startGroup(groupTag: string): void; /** * Stops all jobs with group groupTag * @param groupTag */ stopGroup(groupTag: string): void; /** * Starts the job with handlerTag * @param handlerTag */ startHandler(handlerTag: string): void; /** * stops the job with handlerTag * @param handlerTag */ stopHandler(handlerTag: string): void; getGroups(): string[]; getHandlers(): string[]; }