Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/xotic750/delay-promise-x

Create a delayed promise.
https://github.com/xotic750/delay-promise-x

delay promise

Last synced: about 2 months ago
JSON representation

Create a delayed promise.

Awesome Lists containing this project

README

        


Travis status


Dependency status


devDependency status


npm version


jsDelivr hits


bettercodehub score


Coverage Status

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 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') ;
});
``