p-wait-for
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -1,36 +0,49 @@ | ||
export interface Options { | ||
/** | ||
Number of milliseconds to wait before retrying `condition`. | ||
declare namespace pWaitFor { | ||
interface Options { | ||
/** | ||
Number of milliseconds to wait before retrying `condition`. | ||
@default 20 | ||
*/ | ||
readonly interval?: number; | ||
@default 20 | ||
*/ | ||
readonly interval?: number; | ||
/** | ||
Number of milliseconds to wait before automatically rejecting. | ||
/** | ||
Number of milliseconds to wait before automatically rejecting. | ||
@default Infinity | ||
*/ | ||
readonly timeout?: number; | ||
@default Infinity | ||
*/ | ||
readonly timeout?: number; | ||
} | ||
} | ||
/** | ||
Wait for a condition to be true. | ||
declare const pWaitFor: { | ||
/** | ||
Wait for a condition to be true. | ||
@returns A promise that resolves when `condition` returns `true`. Rejects if `condition` throws or returns a `Promise` that rejects. | ||
@returns A promise that resolves when `condition` returns `true`. Rejects if `condition` throws or returns a `Promise` that rejects. | ||
@example | ||
``` | ||
import pWaitFor from 'p-wait-for'; | ||
import pathExists from 'path-exists'; | ||
@example | ||
``` | ||
import pWaitFor = require('p-wait-for'); | ||
import pathExists = require('path-exists'); | ||
(async () => { | ||
await pWaitFor(() => pathExists('unicorn.png')); | ||
console.log('Yay! The file now exists.'); | ||
})(); | ||
``` | ||
*/ | ||
export default function pWaitFor( | ||
condition: () => PromiseLike<boolean> | boolean, | ||
options?: Options | ||
): Promise<void>; | ||
(async () => { | ||
await pWaitFor(() => pathExists('unicorn.png')); | ||
console.log('Yay! The file now exists.'); | ||
})(); | ||
``` | ||
*/ | ||
(condition: () => PromiseLike<boolean> | boolean, options?: pWaitFor.Options): Promise< | ||
void | ||
>; | ||
// TODO: Remove this for the next major release, refactor the whole definition to: | ||
// declare function pWaitFor( | ||
// condition: () => PromiseLike<boolean> | boolean, | ||
// options?: pWaitFor.Options | ||
// ): Promise<void>; | ||
// export = pWaitFor; | ||
default: typeof pWaitFor; | ||
}; | ||
export = pWaitFor; |
@@ -51,2 +51,3 @@ 'use strict'; | ||
module.exports = pWaitFor; | ||
// TODO: Remove this for the next major release | ||
module.exports.default = pWaitFor; |
{ | ||
"name": "p-wait-for", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "Wait for a condition to be true", | ||
@@ -16,3 +16,3 @@ "license": "MIT", | ||
"scripts": { | ||
"test": "xo && ava && tsd-check" | ||
"test": "xo && ava && tsd" | ||
}, | ||
@@ -41,8 +41,8 @@ "files": [ | ||
"devDependencies": { | ||
"ava": "^1.3.1", | ||
"ava": "^1.4.1", | ||
"delay": "^4.1.0", | ||
"time-span": "^3.0.0", | ||
"tsd-check": "^0.5.0", | ||
"tsd": "^0.7.1", | ||
"xo": "^0.24.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5198
82