# q-promise

> promise polyfill with add-ons

Latest version **1.0.0** (published 2016-12-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install q-promise
pnpm add q-promise
yarn add q-promise
bun add q-promise
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-12-09 |
| First published | 2016-01-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Jesús Germade |
| Maintainers | jgermade |
| Keywords | promise, polyfill, add-ons, when, es6 |

## Links

- npm: https://www.npmjs.com/package/q-promise
- Repository: https://github.com/jstools/q-promise
- Homepage: https://github.com/jstools/q-promise#readme
- Issues: https://github.com/jstools/q-promise/issues
- npm.io page: https://npm.io/package/q-promise

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2016-12-09
- 0.3.7 — 2016-09-26
- 0.3.6 — 2016-09-26
- 0.3.5 — 2016-08-30
- 0.3.4 — 2016-08-30
- 0.3.3 — 2016-08-30
- 0.3.2 — 2016-06-23
- 0.3.1 — 2016-06-23
- 0.3.0 — 2016-06-23
- 0.2.6 — 2016-04-08
- 0.2.5 — 2016-04-08
- 0.2.4 — 2016-04-08
- 0.2.3 — 2016-04-08
- 0.2.2 — 2016-04-08
- 0.2.1 — 2016-01-12
- … 2 more at https://npm.io/package/q-promise/versions

## README

q-promise [![](https://img.shields.io/npm/v/q-promise.svg)](https://www.npmjs.com/package/q-promise) [![](https://img.shields.io/bower/v/q-promise.svg)](http://bower.io/search/?q=q-promise)
==================
[![travis](https://cdn.travis-ci.org/images/favicon-662edf026745110e8203d8cf38d1d325.png)](https://travis-ci.org/jstools/q-promise)
[![Build Status](https://travis-ci.org/jstools/q-promise.svg?branch=master)](https://travis-ci.org/jstools/q-promise)
[![Wercker](http://wercker.com/favicon.ico)](https://app.wercker.com/project/bykey/be7db1dae8daa1a31b992c75d8c9cf83)
[![wercker status](https://app.wercker.com/status/be7db1dae8daa1a31b992c75d8c9cf83/s "wercker status")](https://app.wercker.com/project/bykey/be7db1dae8daa1a31b992c75d8c9cf83)
[![](https://img.shields.io/npm/dm/q-promise.svg)](https://www.npmjs.com/package/q-promise)

> Full [Promises/A+](https://github.com/promises-aplus/promises-spec) [compliance](https://github.com/promises-aplus/promises-tests)

[<img src="https://rawgit.com/promises-aplus/promises-spec/master/logo.svg" width="48">](https://github.com/promises-aplus/promises-spec)

## Installation
```.sh
npm install q-promise --save

# alternatively you can use bower (minified version by default)
bower install q-promise --save
```

## [ES6 Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
``` js
// q-promise respects the es6 promise specification
// you can use q-promise as global polyfill

if( !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
```

---
_Source: https://npm.io/package/q-promise · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
