mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
* Skip unnecessary checks on pre commit * Remove grunt precommit task * Separate go and fe tesrt lint
24 lines
430 B
TypeScript
24 lines
430 B
TypeScript
export type TaskRunner<T> = (options: T) => Promise<any>;
|
|
|
|
export class Task<TOptions> {
|
|
name: string;
|
|
runner: (options: TOptions) => Promise<any>;
|
|
options: TOptions;
|
|
|
|
setName = name => {
|
|
this.name = name;
|
|
};
|
|
|
|
setRunner = (runner: TaskRunner<TOptions>) => {
|
|
this.runner = runner;
|
|
};
|
|
|
|
setOptions = options => {
|
|
this.options = options;
|
|
};
|
|
|
|
exec = () => {
|
|
return this.runner(this.options);
|
|
};
|
|
}
|