Yet another Promises/A+ implementation.
$ npm install yapa
var yapa = require'yapa';
Constructs a new promise, but you probably already knew that.
var promise = ;
Transitions promise from pending state to fulfilled state. The promise's
onFulfilled callbacks will be invoked in the order they were attached.
value will be the argument passed to the promise's
Transitions promise from pending state to rejected state. The promise's
onRejected callbacks will be invoked in the order they were attached.
reason will be the argument passed to the promise's
Provides an interface for accessing the promise's current or eventual fulfillment value or rejection reason. When the promise is fulfilled or rejected, the corresponding callback will be invoked. If the promise has already been fulfilled or rejected, the corresponding callback will be invoked on the next loop through the event queue.
var /* celebrate! *//* mourn */ ;promisethenonFulfilled onRejected;
Similar to the
then method, however rather than have
onFulfilled's argument list only consist of the promise's fulfillment value, its argument list consists of the promise's fulfillment value and the fulfillment values of all of the preceding promises in the promise chain.
promisethen return 123;then return 'do re mi';valuesconsole.logstart;console.log'easy as %s' easyAs;console.log'simple as %s' simpleAs;;promisefulfill'abc';
$ cd yapa$ npm test
Found a bug? Create an issue on GitHub.
For transparency and insight into the release cycle, releases will be numbered with the follow format:
And constructed with the following guidelines:
For more information on semantic versioning, please visit http://semver.org/.
Copyright (c) 2013 Jake Harding
Licensed under the MIT License.