123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- import { ChildProcess } from "child_process";
- import { EventEmitter } from "events";
- import { Stream } from "stream";
- declare namespace asyncDone {
-
- type VoidCallback = (err: Error | null) => void;
-
- interface Callback<T> {
- (err: null, result: T): void;
-
-
- (err: Error, result?: any): void;
- }
-
- interface Observable<T = any> {
- subscribe(next?: (value: T) => void, error?: (error: any) => void, complete?: () => void): any;
- }
-
- export type AsyncTask<R = any> =
- ((done: VoidCallback) => void)
- | ((done: Callback<R>) => void)
- | (() => ChildProcess | EventEmitter | Observable<R> | PromiseLike<R> | Stream);
- }
- /**
- * Takes a function to execute (`fn`) and a function to call on completion (`callback`).
- *
- * @param fn Function to execute.
- * @param callback Function to call on completion.
- */
- declare function asyncDone<R = any>(fn: asyncDone.AsyncTask<R>, callback: asyncDone.Callback<R>): void;
- export = asyncDone;
|