npm install q-promiseq-promise  
==================





> Full Promises/A+ compliance
.sh
npm install q-promise --savealternatively you can use bower (minified version by default)
bower install q-promise --save
`ES6 Promise
` js
// q-promise respects the es6 promise specification
// you can use q-promise as global polyfillif( !window.Promise ) {
window.Promise = $q;
}
`Example
` js
$q(function (resolve, reject) {
resolve('gogogo!');
}) .then(function (result) {
console.log('checkpoint 1', result);
throw 'whoops!';
})
.then(function (result) {
console.log('checkpoint 2', result);
},function (result) {
console.log('checkpoint 2.1', result);
return qPromise(function (resolve, reject) {
setTimeout(function () { resolve('all right!'); }, 400);
});
})
.then(function (result) {
console.log('checkpoint 3', result);
}, function (reason) {
console.log('checkpoint 3.1', reason);
})
;
`
output:
`.sh
checkpoint 1 gogogo!
checkpoint 2.1 whoops!
elapsed 400ms
checkpoint 3 all right!
`Tests
-----
` sh
make test
``