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

    Keywords

    none

    Install

    npm i promise-creator

    DownloadsWeekly Downloads

    0

    Version

    1.1.0

    License

    MIT

    Last publish

    Collaborators

    • avatar