1.0.1 • Published 8 years ago

yaDeferred v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
8 years ago

Yet another deferred implementation

Build Status

You can never have enough of these, right?

Small, zero dependency deferred utility based on ES2015 promises.

Does not include the promise polyfill, so you have to take care of it yourself folks.

es6-promise

Installation

npm install --save yaDeferred

Usage

const yaDeferred = require('yaDeferred');

yaDeferred()
    .resolve(true)
    .then(result => console.log(result));

API

resolve

yaDeferred.resolve()

resolves the promise with a given value and returns the promise

reject

yaDeferred.reject()

rejects the promise with a given value and returns the promise

then

yaDeferred.then()

then is a direct call to the original promise then method

catch

yaDeferred.catch()

catch is a direct call to the original promise catch method