promise-creator
1.1.0 • Public • Published Promise creator
small helper function to easly create new promises
instalation
npm install promise-creator --save
usage
import promiseCreator from 'promise-creator';
const { resolve, reject, promise } = promiseCreator();
return promise;
example
function delay(ms) {
const {resolve, reject, promise} = promiseCreator();
setTimeout(function() {
resolve();
}, ms);
return promise;
}
delay(5000).then(function() {
console.log('you are awesome ✨👍');
});
Readme
Keywords
nonePackage Sidebar
Install
Weekly Downloads