NOTE. Documentation for old versions of the library can be found at https://github.com/dfilatov/vow/blob/0.3.x/README.md.
Vow
Vow is a Promises/A+ implementation.
It also supports DOM Promises specification.
Getting Started
In Node.js
You can install using Node Package Manager (npm):
npm install vow
In Browsers
<script type="text/javascript" src="vow.min.js"></script>
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
Creating a promise
There are two possible ways to create a promise.
1. Using a deferred
function doSomethingAsync() {
var deferred = vow.defer();
return deferred.promise();
}
doSomethingAsync().then(
function() {},
function() {},
function() {}
);
The difference between deferred
and promise
is that deferred
contains methods to resolve, reject and notify corresponding promise, but the promise
by itself allows subscribe to reactions on this actions only.
2. ES6-compatible way
function doSomethingAsync() {
return new vow.Promise(function(resolve, reject, notify) {
});
}
doSomethingAsync().then(
function() {},
function() {},
function() {}
);
Full API reference can be found at http://dfilatov.github.io/vow/.