promise-creator

1.1.0 • Public • Published

Promise creator

Build Status

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

none

Package Sidebar

Install

npm i promise-creator

Weekly Downloads

3

Version

1.1.0

License

MIT

Last publish

Collaborators

  • feroc1ty