// Type definitions for asyncblock 2.1.23 // Project: https://github.com/scriby/asyncblock // Definitions by: Hiroki Horiuchi // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module "asyncblock" { function asyncblock(f: (flow: asyncblock.IFlow) => void, callback?: (err: any, res: T) => void): void; module asyncblock { export function nostack(f: (flow: asyncblock.IFlow) => void, callback?: (err: any, res: T) => void): void; export interface IFlow { add(responseFormat?: string[]): IExecuteFunction; add(key: string, responseFormat?: string[]): IExecuteFunction; add(key: number, responseFormat?: string[]): IExecuteFunction; add(options: IFlowOptions): IExecuteFunction; callback(responseFormat?: string[]): IExecuteFunction; callback(key: string, responseFormat?: string[]): IExecuteFunction; callback(key: number, responseFormat?: string[]): IExecuteFunction; callback(options: IFlowOptions): IExecuteFunction; wait(key?: string): T; wait(key?: number): T; get(key: string): T; set(key: string, responseFormat?: string[]): IExecuteFunction; set(options: IFlowOptions): IExecuteFunction; del(key: string): void; sync(task: any): T; queue(toExecute: IExecuteFunction): void; queue(key: string, toExecute: IExecuteFunction): void; queue(key: number, toExecute: IExecuteFunction): void; queue(responseFormat: string[], toExecute: IExecuteFunction): void; queue(key: string, responseFormat: string[], toExecute: IExecuteFunction): void; queue(key: number, responseFormat: string[], toExecute: IExecuteFunction): void; queue(options: IFlowOptions, toExecute: IExecuteFunction): void; doneAdding(): void; forceWait(): T; maxParallel: number; errorCallback: (err: any) => void; taskTimeout: number; timeoutIsError: boolean; } export interface IFlowOptions { ignoreError?: boolean; // default false key?: string; // string | number responseFormat?: string[]; timeout?: number; timeoutIsError?: boolean; dontWait?: boolean; firstArgIsError?: boolean; // default true } export interface IExecuteFunction { (err: any, res1: T1, res2: T2, res3: T3): any; (err: any, res1: T1, res2: T2): any; (err: any, res: T): any; (err: any): any; // firstArgIsError === false (res1: T1, res2: T2, res3: T3): any; (res1: T1, res2: T2): any; (res: T): any; } } export = asyncblock; }