UNPKG

954 BTypeScriptView Raw
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 */
7export declare type Options = {
8 clearTimeout: typeof globalThis['clearTimeout'];
9 fail: (error: Error) => void;
10 onException: (error: Error) => void;
11 queueableFns: Array<QueueableFn>;
12 setTimeout: typeof globalThis['setTimeout'];
13 userContext: unknown;
14};
15export interface DoneFn {
16 (error?: any): void;
17 fail: (error: Error) => void;
18}
19export declare type QueueableFn = {
20 fn: (done: DoneFn) => void;
21 timeout?: () => number;
22 initError?: Error;
23};
24declare type PromiseCallback = (() => void | PromiseLike<void>) | undefined | null;
25export default function queueRunner(options: Options): PromiseLike<void> & {
26 cancel: () => void;
27 catch: (onRejected?: PromiseCallback) => Promise<void>;
28};
29export {};