mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-22 15:24:55 +00:00
19 lines
573 B
TypeScript
19 lines
573 B
TypeScript
import Dictionary from 'Common/Types/Dictionary';
|
|
import BadDataException from 'Common/Types/Exception/BadDataException';
|
|
|
|
export default class JobDictionary {
|
|
private static dictionary: Dictionary<Function> = {};
|
|
|
|
public static getJobFunction(name: string): Function {
|
|
if (this.dictionary[name]) {
|
|
return this.dictionary[name] as Function;
|
|
}
|
|
|
|
throw new BadDataException('No job found with name: ' + name);
|
|
}
|
|
|
|
public static setJobFunction(name: string, job: Function): void {
|
|
this.dictionary[name] = job;
|
|
}
|
|
}
|