JSPM

  • Created
  • Published
  • Downloads 122581
  • Score
    100M100P100Q163580F

Promises/A+ proposal compatible promises library

Package Exports

  • vow

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vow) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Vow Build Status

Promises/A+ specification compatible promises library. See https://github.com/promises-aplus/promises-spec.

Getting Started

###In the Node.js### You can install using Node Package Manager (npm):

npm install vow

###In the Browsers###

<script type="text/javascript" src="vow.min.js"></script>

Also RequireJS module format supported.

API

####Vow.promise()#### Create promise

var promise = Vow.promise();    

###Promise API### ####fulfill(value)#### Fulfill promise with given value

promise.fulfill(value);

####reject(reason)#### Reject promise with given reason

promise.reject(error);

####isFulfilled()#### Returns whether the promise is fulfilled

promise.isFulfilled();

####isRejected()#### Returns whether the promise is rejected

promise.isRejected();

####isResolved()#### Returns whether the promise is fulfilled or rejected

promise.isResolved();

####then([onFulfilled], [onRejected])#### Arranges for:

  • onFulfilled to be called with the value after promise is fulfilled,
  • onRejected to be called with the rejection reason after promise is rejected.

Returns a new promise. See Promises/A+ specification for details.

promise.then(onFulfilled, onRejected);

####fail(onRejected)#### Arranges to call onRejected on the promise's rejection reason if it is rejected. ####spread([onFulfilled], [onRejected])#### Like "then", but "spreads" the array into a variadic value handler.

###Vow API### ####isPromise(value)#### Returns whether the given value is a promise.

####fulfill(value)#### Returns a promise that has already been fulfilled with the given value. If value is a promise, returned promise will be fulfilled with fulfill/rejection value of given promise.

####reject(reasonOrPromise)#### Returns a promise that has already been rejected with the given value. If value is a promise, returned promise will be rejected with fulfill/rejection value of given promise.

####when(valueOrPromise, [onFulfilled], [onRejected])#### ####all(promisesOrValues)#### ####allResolved(promisesOrValues)#### ####any(promisesOrValues)#### ####timeout(promise, timeout)####