UNPKG

1.9 kBTypeScriptView Raw
1// Type definitions for undertaker-registry 1.0
2// Project: https://github.com/gulpjs/undertaker-registry
3// Definitions by: Giedrius Grabauskas <https://github.com/GiedriusGrabauskas>
4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
6declare class UndertakerRegistry {
7 /**
8 * Returns the task with that name or undefined if no task is registered with that name.
9 * Useful for custom task storage.
10 * Custom registries can override this method when inheriting from this default registry.
11 * @param taskName - Name of task.
12 */
13 get<TTaskFunction>(taskName: string): TTaskFunction;
14
15 /**
16 * No-op method that receives the undertaker instance.
17 * Useful to set pre-defined tasks using the undertaker.task(taskName, fn) method.
18 * Custom registries can override this method when inheriting from this default registry.
19 * @param taker - Instance of undertaker.
20 */
21 init(taker: any): void;
22
23 /**
24 * Adds a task to the registry.
25 * If set modifies a task, it should return the new task so Undertaker can properly maintain metadata for the task.
26 * Useful for adding custom behavior to every task as it is registered in the system.
27 * Custom registries can override this method when inheriting from this default registry.
28 * @param taskName - Name of task.
29 * @param fn - Task function.
30 */
31 set<TTaskFunction>(taskName: string, fn: TTaskFunction): TTaskFunction;
32
33 /**
34 * Returns an object listing all tasks in the registry.
35 * Necessary to override if the get method is overridden for custom task storage.
36 * Custom registries can override this when when inheriting from this default registry.
37 */
38 tasks(): { [taskName: string]: (...args: any[]) => any };
39}
40
41declare namespace UndertakerRegistry { }
42
43export = UndertakerRegistry;