@types/undertaker

  • Version 1.2.7
  • Published
  • 8.47 kB
  • 3 dependencies
  • MIT license

Install

npm i @types/undertaker
yarn add @types/undertaker
pnpm add @types/undertaker

Overview

TypeScript definitions for undertaker

Index

Classes

class Undertaker

class Undertaker extends EventEmitter {}

    constructor

    constructor(registry?: any);

      method lastRun

      lastRun: (task: Undertaker.Task, timeResolution?: number) => number;
      • Takes a string or function (task) and returns a timestamp of the last time the task was run successfully. The time will be the time the task started. Returns undefined if the task has not been run.

        Parameter task

        Task.

        Parameter timeResolution

        Time resolution.

      method parallel

      parallel: {
      (...tasks: Undertaker.Task[]): Undertaker.TaskFunction;
      (tasks: Undertaker.Task[]): Undertaker.TaskFunction;
      };
      • Takes a variable amount of strings (taskName) and/or functions (fn) and returns a function of the composed tasks or functions. Any taskNames are retrieved from the registry using the get method.

        When the returned function is executed, the tasks or functions will be executed in parallel, all being executed at the same time. If an error occurs, all execution will complete.

        Parameter tasks

        list of tasks.

      method registry

      registry: { (): any; (registry: any): void };
      • Returns the current registry object.

      • The tasks from the current registry will be transferred to it and the current registry will be replaced with the new registry.

        Parameter registry

        Instance of registry.

      method series

      series: {
      (...tasks: Undertaker.Task[]): Undertaker.TaskFunction;
      (tasks: Undertaker.Task[]): Undertaker.TaskFunction;
      };
      • Takes a variable amount of strings (taskName) and/or functions (fn) and returns a function of the composed tasks or functions. Any taskNames are retrieved from the registry using the get method.

        When the returned function is executed, the tasks or functions will be executed in series, each waiting for the prior to finish. If an error occurs, execution will stop.

        Parameter tasks

        List of tasks.

      method task

      task: {
      (taskName: string): Undertaker.TaskFunctionWrapped;
      (taskName: string, fn: Undertaker.TaskFunction): void;
      (fn: Undertaker.TaskFunction): void;
      };
      • Returns the wrapped registered function.

        Parameter taskName

        Task name.

      • Register the task by the taskName.

        Parameter taskName

        Task name.

        Parameter fn

        Task function.

      • Register the task by the name property of the function.

        Parameter fn

        Task function.

      method tree

      tree: (options?: Undertaker.TreeOptions) => Undertaker.TreeResult;
      • Optionally takes an object (options) and returns an object representing the tree of registered tasks.

        Parameter options

        Tree options.

      Interfaces

      interface Node

      interface Node {}

        property branch

        branch?: boolean | undefined;

          property label

          label: string;

            property nodes

            nodes: Node[];

              property type

              type?: string | undefined;

                interface TaskCallback

                interface TaskCallback {}

                  call signature

                  (error?: Error | null): void;

                    interface TaskFlags

                    interface TaskFlags {}

                      index signature

                      [arg: string]: string;

                        interface TaskFunction

                        interface TaskFunction extends TaskFunctionBase, TaskFunctionParams {}

                          interface TaskFunctionBase

                          interface TaskFunctionBase {}

                            call signature

                            (done: TaskCallback): ReturnType<AsyncTask>;

                              interface TaskFunctionParams

                              interface TaskFunctionParams {}

                                property description

                                description?: string | undefined;

                                  property displayName

                                  displayName?: string | undefined;

                                    property flags

                                    flags?: TaskFlags | undefined;

                                      property name

                                      readonly name?: string | undefined;

                                        interface TaskFunctionWrapped

                                        interface TaskFunctionWrapped extends TaskFunctionBase {}

                                          property displayName

                                          displayName: string;

                                            method unwrap

                                            unwrap: () => TaskFunction;

                                              interface TreeOptions

                                              interface TreeOptions {}

                                                property deep

                                                deep?: boolean | undefined;
                                                • Whether or not the whole tree should be returned. Default: false

                                                interface TreeResult

                                                interface TreeResult {}

                                                  property label

                                                  label: 'Tasks';

                                                    property nodes

                                                    nodes: Node[];

                                                      Type Aliases

                                                      type Task

                                                      type Task = string | TaskFunction;

                                                        Package Files (1)

                                                        Dependencies (3)

                                                        Dev Dependencies (0)

                                                        No dev dependencies.

                                                        Peer Dependencies (0)

                                                        No peer dependencies.

                                                        Badge

                                                        To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/undertaker.

                                                        • Markdown
                                                          [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/undertaker)
                                                        • HTML
                                                          <a href="https://www.jsdocs.io/package/@types/undertaker"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>