promise-q

0.1.18 • Public • Published

jsTools: promise-q wercker status

Installation

npm install promise-q --save

or

bower install promise-q --save

Usage

$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:

checkpoint 1 gogogo!
checkpoint 2.1 whoops!
# elapsed 400ms
checkpoint 3 all right!

Package Sidebar

Install

npm i promise-q

Weekly Downloads

20

Version

0.1.18

License

MIT

Last publish

Collaborators

  • gsusgz