dce-mango
Version:
Harvard DCE's Non-relational DB Wrapper.
19 lines (18 loc) • 700 B
TypeScript
export declare class PollingError extends Error {
constructor(message?: string);
}
/**
* Function for polling a given resource.
* @author Benedikt Arnarsson
* @param opts.callResource the function for calling the external resource
* @param opts.validateResult validate that we got the result we want from the resource
* @param opts.waitForMS time between calls to the resource (in milliseconds)
* @param opts.maxAttempts the maximum number of attempts (defaults to 'infinity')
*/
declare const pollResource: <T>(opts: {
callResource: () => Promise<T>;
validateResult: (res: T) => boolean;
waitForMS: number;
timeOut?: number;
}) => Promise<T>;
export default pollResource;