promise.d.ts 630 B

1234567891011121314151617
  1. export declare type ResolveAndRejectCallback<T> = (resolve: (value: T) => void, reject: (params: any) => void) => void;
  2. export declare enum PromiseStatus {
  3. IN_PROGRESS = 0,
  4. RESOLVED = 1
  5. }
  6. export declare class Promise<T> {
  7. private status;
  8. private resolution;
  9. private waiters;
  10. static all<T>(promises: Promise<T>[]): Promise<T[]>;
  11. static resolve<T>(value?: T): Promise<T>;
  12. constructor(callback: ResolveAndRejectCallback<T>);
  13. then<V>(func: (result: T) => V): Promise<V>;
  14. resolveNow<Z>(ifNotResolvedValue: Z, ifResolved: (current: T | null) => Z): Z;
  15. private onDone;
  16. private onReject;
  17. }