1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/backend/model/tasks/TaskRepository.ts
Patrik J. Braun 1ddc73d461 improving tasks settings
updating settings
version bump
2019-12-07 18:16:37 +01:00

31 lines
844 B
TypeScript

import {ITask} from './ITask';
import {IndexingTask} from './IndexingTask';
import {DBRestTask} from './DBResetTask';
import {DummyTask} from './DummyTask';
export class TaskRepository {
private static instance: TaskRepository = null;
availableTasks: { [key: string]: ITask<any> } = {};
public static get Instance(): TaskRepository {
if (TaskRepository.instance == null) {
TaskRepository.instance = new TaskRepository();
}
return TaskRepository.instance;
}
getAvailableTasks(): ITask<any>[] {
return Object.values(this.availableTasks).filter(t => t.Supported);
}
register(task: ITask<any>) {
this.availableTasks[task.Name] = task;
}
}
TaskRepository.Instance.register(new IndexingTask());
TaskRepository.Instance.register(new DBRestTask());
// TaskRepository.Instance.register(new DummyTask());