DOM Promise and Promises/A+ implementation for Node.js and browsers
npm install vow
Vow



=========
Vow is a Promises/A+ implementation.
It also supports ES6 Promises specification.
Full API reference can be found at http://dfilatov.github.io/vow/.
Getting Started
---------------
html
`
It also supports RequireJS module format and YM module format.
Vow has been tested in IE6+, Mozilla Firefox 3+, Chrome 5+, Safari 5+, Opera 10+.
Usage
-----
$3
There are two possible ways to create a promise.
#### 1. Using a deferred ####
`js
function doSomethingAsync() {
var deferred = vow.defer();
// now you can resolve, reject, notify corresponging promise within deferred
// e.g. defer.resolve('ok');
return deferred.promise(); // and return corresponding promise to subscribe to reactions
}
doSomethingAsync().then(
function() {}, // onFulfilled reaction
function() {}, // onRejected reaction
function() {} // onNotified reaction
);
`
The difference between deferred and promise is that deferred contains methods to resolve, reject and notify corresponding promise, but the promise by itself allows only to subscribe on these actions.
#### 2. ES6-compatible way ####
`js
function doSomethingAsync() {
return new vow.Promise(function(resolve, reject, notify) {
// now you can resolve, reject, notify the promise
});
}
doSomethingAsync().then(
function() {}, // onFulfilled reaction
function() {}, // onRejected reaction
function() {} // onNotified reaction
);
``