UNPKG

nope-js-node

Version:

NoPE Runtime for Nodejs. For Browser-Support please use nope-browser

53 lines (52 loc) 1.66 kB
/** * @author Martin Karkowski * @email m.karkowski@zema.de */ /** * Delays some execution. Sleeps the amount of time in **ms** * @param delay [ms] * @returns void */ export declare function sleep(delay: number): Promise<void>; /** * Tests if a Function is async or not. * @param func The function to test. * @returns {boolean} The test result. */ export declare function isAsyncFunction(func: (...args: any[]) => any): boolean; /** * Function which will halt the Process until the Testcallback deliveres "true" * * @export * @param {(() => boolean | Promise<boolean>)} testCallback Function which is used to periodically test the State * @param {{ testFirst?: boolean; maxRetries?: number, timeout?: number, maxTimeout?: number }} [options={}] Options to enhance the behavior. Look at the details * @returns */ export declare function waitFor(testCallback: () => boolean | Promise<boolean>, options?: { /** * Inital delay, before the test is started. */ initialWait?: number; /** * Flag to enable testing the call the callback directly before * proceeding or just ensure the inital waiting time */ testFirst?: boolean; /** * Max amount of retries before an execption is raised */ maxRetries?: number; /** * Delay to wait, after an unsucessfull test. */ delay?: number; /** * Timeout afterwhich the Test will fail. */ maxTimeout?: number; /** * A Delay which is added after the Test is fullfilled, * before the Promise is done. */ additionalDelay?: number; }): Promise<void>;