delay-promise-x
v1.1.2
Published
Create a delayed promise.
Downloads
49
Readme
delay-promise-x
Returns a promise that will be resolved with value (or undefined) after given ms milliseconds. If value is a promise, the delay will start counting down when it is fulfilled and the returned promise will be fulfilled with the fulfillment value of the value promise.
delayPromise(
int ms,
[any|Promise<any> value=undefined]
) -> Promise
Basic examples
delayPromise(500).then(function() {
console.log('500 ms passed');
return delayPromise(500, 'Hello world');
}).then(function(helloWorldString) {
console.log(helloWorldString);
console.log('another 500 ms passed') ;
});
``