proback.js
Advanced tools
Comparing version 2.1.8 to 2.1.10
@@ -19,4 +19,5 @@ module.exports = { | ||
}, | ||
until: function ( fn, ms = 100 ) { | ||
return new Promise(resolve => { | ||
until: function ( fn, ms = 100, max = -1 ) { | ||
return new Promise( (resolve, reject) => { | ||
let time = Date.now() | ||
let pingInterval = setInterval( function () { | ||
@@ -27,2 +28,6 @@ if ( fn() ) { | ||
} | ||
else if ( max > -1 && (Date.now() - time) >= max ) { | ||
clearInterval( pingInterval ) | ||
reject( new Error( 'Function never made it in ' + max + ' ms' ) ) | ||
} | ||
}, ms ) | ||
@@ -29,0 +34,0 @@ } ) |
{ | ||
"name": "proback.js", | ||
"version": "2.1.8", | ||
"version": "2.1.10", | ||
"description": "Tiny libary to aid Promise/Callback dual API design", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
14425
347