Socket
Socket
Sign inDemoInstall

wait-until-promise

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.2 to 0.1.3

API.md

11

CHANGELOG.md

@@ -8,6 +8,10 @@ # Change Log

## [0.1.3] - 2016-05-28
### Changed
- Generate API documentation using documentation.js
## [0.1.2] - 2016-04-22
### Changed
- Throw error if no `Promise` available on invocation, instead of warning on at
first invocation
- Throw error if no `Promise` available on invocation, instead of warning as a
side effect of importing the module
- Reject with a `TimeoutError`, like Bluebird provides, if available

@@ -35,3 +39,4 @@

[Unreleased]: https://github.com/SimenB/wait-until-promise/compare/v0.1.2...HEAD
[Unreleased]: https://github.com/SimenB/wait-until-promise/compare/v0.1.3...HEAD
[0.1.3]: https://github.com/SimenB/wait-until-promise/compare/v0.1.2...v0.1.3
[0.1.2]: https://github.com/SimenB/wait-until-promise/compare/v0.1.1...v0.1.2

@@ -38,0 +43,0 @@ [0.1.1]: https://github.com/SimenB/wait-until-promise/compare/v0.1.0...v0.1.1

@@ -23,2 +23,9 @@ (function (global, factory) {

/**
* Clears the specified timeout and interval.
*
* @param {number} timeout - Id if the timeout to clear.
* @param {number} interval - Id of the interval to clear.
* @private
*/
function clearTimers(timeout, interval) {

@@ -29,2 +36,8 @@ clearTimeout(timeout);

/**
* Set a custom {@link Promise} implementation.
*
* @param {Function} implementation - A promise implementation to use instead of native {@link Promise}.
* @static
*/
var setPromiseImplementation = exports.setPromiseImplementation = function (implementation) {

@@ -34,2 +47,14 @@ PromiseImplementation = implementation;

/**
* Create a {@link Promise} that resolves if the given escapeFunction returns a truthy value, and rejects if it throws
* or does not return truthy within the given maxWait.
*
* @param {Function} escapeFunction - The function called every checkDelay, and the result of which is the resolved
* value of the promise.
* @param {number} [maxWait=50] - The time to wait before rejecting the promise.
* @param {number} [checkDelay=1] - The time to wait before each invocation of {escapeFunction}.
* @returns {Promise} A promise resolved with the value of escapeFunction, or rejected with the exception thrown by it
* or it times out.
*/
exports['default'] = function (escapeFunction) {

@@ -36,0 +61,0 @@ var maxWait = arguments.length <= 1 || arguments[1] === undefined ? 50 : arguments[1];

{
"name": "wait-until-promise",
"version": "0.1.2",
"version": "0.1.3",
"description": "A simple utilty to wait until condition is true, returning a promise",
"main": "index.js",
"files": [
"index.js"
"index.js",
"API.md"
],

@@ -13,2 +14,3 @@ "scripts": {

"cover": "nyc ava",
"doc": "documentation readme waitUntilPromise.js --readme-file API.md -s API --github",
"lint": "eslint waitUntilPromise.js test.js",

@@ -20,3 +22,4 @@ "postcover": "nyc report --reporter=html",

"prelint": "npm run clean",
"prepublish": "not-in-install && npm run compile || echo this is npm install",
"prepublish": "not-in-install && npm run compile && npm run doc || in-install",
"postpublish": "git push --follow-tags",
"pretest": "npm run lint",

@@ -40,26 +43,28 @@ "test": "ava",

"devDependencies": {
"ava": "^0.14.0",
"babel-cli": "^6.7.7",
"babel-eslint": "^6.0.3",
"babel-plugin-transform-es2015-arrow-functions": "^6.7.7",
"babel-plugin-transform-es2015-block-scoping": "^6.7.1",
"babel-plugin-transform-es2015-modules-umd": "^6.6.5",
"babel-plugin-transform-es2015-parameters": "^6.7.0",
"babel-plugin-transform-es3-member-expression-literals": "^6.5.0",
"babel-register": "^6.7.2",
"ava": "^0.15.0",
"babel-cli": "^6.8.0",
"babel-eslint": "^6.0.4",
"babel-plugin-transform-es2015-arrow-functions": "^6.8.0",
"babel-plugin-transform-es2015-block-scoping": "^6.8.0",
"babel-plugin-transform-es2015-modules-umd": "^6.8.0",
"babel-plugin-transform-es2015-parameters": "^6.8.0",
"babel-plugin-transform-es3-member-expression-literals": "^6.8.0",
"babel-register": "^6.8.0",
"bluebird": "^3.3.5",
"codeclimate-test-reporter": "^0.3.1",
"coveralls": "^2.11.9",
"eslint": "^2.8.0",
"eslint-config-standard": "^5.1.0",
"eslint-plugin-ava": "^2.2.1",
"documentation": "4.0.0-beta4",
"eslint": "^2.10.1",
"eslint-config-standard": "^5.3.1",
"eslint-plugin-ava": "^2.3.1",
"eslint-plugin-babel": "^3.2.0",
"eslint-plugin-jsdoc": "^2.3.1",
"eslint-plugin-promise": "^1.1.0",
"eslint-plugin-standard": "^1.3.2",
"in-publish": "^2.0.0",
"nyc": "^6.4.0",
"nyc": "^6.4.4",
"rimraf": "^2.5.2",
"sinon": "^1.17.3"
"sinon": "^1.17.4"
},
"dependencies": {}
}
# wait-until-promise
> Test utility to simplify waiting for a condition

@@ -50,27 +51,5 @@

## API
The module provides 2 exports, the `waitUntil` function, and a named export
`setPromiseImplementation`. By default the global `Promise` is used, but
`setPromiseImplementation` allows you to pass in any implementation to use,
such as Bluebird or other A* implementations.
See [API.md](API.md)
### Arguments for `waitUntil`
#### `escapeFunction`
Type: `function`, mandatory
The function used to check if the promise should be resolved. It has to return
a truthy value to successfully resolve. The promise is resolved with the value
returned
#### `maxWait`
Type: `integer`, default: `50`
The time to wait before timing out, and rejecting the promise.
#### `checkDelay`
Type: `integer`, default: `1`
The interval to wait between each invocation of `escapeFunction`.
## Change log

@@ -77,0 +56,0 @@ See [CHANGELOG.md](CHANGELOG.md)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc