queueRunner.d.ts 1.1 KB

123456789101112131415161718192021222324252627
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. declare type Global = NodeJS.Global;
  8. export declare type Options = {
  9. clearTimeout: Global['clearTimeout'];
  10. fail: (error: Error) => void;
  11. onException: (error: Error) => void;
  12. queueableFns: Array<QueueableFn>;
  13. setTimeout: Global['setTimeout'];
  14. userContext: any;
  15. };
  16. export declare type QueueableFn = {
  17. fn: (done: (error?: any) => void) => void;
  18. timeout?: () => number;
  19. initError?: Error;
  20. };
  21. export default function queueRunner(options: Options): {
  22. cancel: any;
  23. catch: <TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined) => Promise<void | TResult>;
  24. then: <TResult1 = void, TResult2 = never>(onfulfilled?: ((value: void) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>;
  25. };
  26. export {};
  27. //# sourceMappingURL=queueRunner.d.ts.map