@ose4g/cron-manager
Version:
Npm package for ease of working with cron jobs
19 lines (18 loc) • 781 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.cronGroup = exports.GROUP_SYMBOL = void 0;
require("reflect-metadata");
exports.GROUP_SYMBOL = Symbol('group');
/**
* Decorator for the Cron Job class
* @param groupTag 'tag of the group. It is used to uniquely identify this class so that all jobs in the class can be started or stoppoed using this key
* @returns A class Decorator
*/
function cronGroup(groupTag) {
return function (constructor) {
var groups = Reflect.getMetadata(exports.GROUP_SYMBOL, Reflect) || [];
groups.push({ groupTag: groupTag, constructor: constructor, className: constructor.name });
Reflect.defineMetadata(exports.GROUP_SYMBOL, groups, Reflect);
};
}
exports.cronGroup = cronGroup;