- lazy(): {
do(cb: ((done: Function, value: unknown) => void | Promise<any>)): { do(cb: (done: Function, value: unknown) => void | Promise<any>): ...; wait(ms: number): ...; };
wait(ms: number): { do(cb: (done: Function, value: unknown) => void | Promise<any>): ...; wait(ms: number): ...; };
} 返回 {
do(cb: ((done: Function, value: unknown) => void | Promise<any>)): { do(cb: (done: Function, value: unknown) => void | Promise<any>): ...; wait(ms: number): ...; };
wait(ms: number): { do(cb: (done: Function, value: unknown) => void | Promise<any>): ...; wait(ms: number): ...; };
}
do:function
- do(cb): { do(cb: (done: Function, value: unknown) => void | Promise<any>): ...; wait(ms: number): ...; }
参数
- cb: ((done: Function, value: unknown) => void | Promise<any>)
- (done, value): void | Promise<any>
参数
- done: Function
- value: unknown
返回 void | Promise<any>
返回 { do(cb: (done: Function, value: unknown) => void | Promise<any>): ...; wait(ms: number): ...; }
wait:function
- wait(ms): { do(cb: (done: Function, value: unknown) => void | Promise<any>): ...; wait(ms: number): ...; }
返回 { do(cb: (done: Function, value: unknown) => void | Promise<any>): ...; wait(ms: number): ...; }
一种队列,分支wait和do
和async、await组合的区别是,lazy支持运行时编程