Skip to content

Latest commit

 

History

History
63 lines (39 loc) · 2.4 KB

index.md

File metadata and controls

63 lines (39 loc) · 2.4 KB

Table of Contents

TaskRet

flow type: TaskRet = any

Type: any

Task

flow type: Task = (depRets?:{ [taskKey:string]: any }) => Promise<TaskRet>;

Type: function (depRets: {}): Promise<TaskRet>

TaskScheduler

constructor

Creates an instance of TaskScheduler.

addTask

Add a task. Must be called before start() is called. Should not be called more than once for each task or all except the last one is effective. There is no requirements in the order in which tasks are added. A task must return a promise, if a task is synchronous, just wrap the return value in a promise, like return Promise.resolve(whatEver);

Parameters

Returns any

appendTask

Add a task after start() is called. Name should not already be added previously otherwise the behaviour is not defined.

Parameters

Returns any

start

Begin executing all tasks. Each task is executed only after its dependent tasks have already finished and receive their returned values as a 'taskName -> value' map in a single argument. Tasks that have no dependent tasks or all its depended tasks have finished will be executed concurrently.

Returns Promise<{}>