# es6-promise-polyfill

> Polyfill for ES6 Promise

Latest version **1.2.0** (published 2015-12-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install es6-promise-polyfill
pnpm add es6-promise-polyfill
yarn add es6-promise-polyfill
bun add es6-promise-polyfill
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2015-12-08 |
| First published | 2014-06-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 104 |
| Author | Roman Dvornov |
| Maintainers | lahmatiy |
| Keywords | es6, es2015, polyfill, promise, promises |

## Links

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

## Alternatives

- [promise-throttle](https://npm.io/package/promise-throttle.md) — 44.2K weekly downloads
- [@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

## Recent versions

- 1.2.0 (latest) — 2015-12-08
- 1.1.1 — 2015-10-18
- 1.1.0 — 2015-10-15
- 1.0.3 — 2015-09-30
- 1.0.2 — 2015-09-14
- 1.0.1 — 2015-09-14
- 1.0.0 — 2014-06-19

## README

[![NPM version](https://img.shields.io/npm/v/es6-promise-polyfill.svg)](https://www.npmjs.com/package/es6-promise-polyfill)
[![Build Status](https://travis-ci.org/lahmatiy/es6-promise-polyfill.svg?branch=master)](https://travis-ci.org/lahmatiy/es6-promise-polyfill)

# ES6 Promise polyfill

This is a polyfill of [ES6 Promise](https://github.com/domenic/promises-unwrapping). The implementation based on [Jake Archibald implementation](https://github.com/jakearchibald/es6-promise) a subset of [rsvp.js](https://github.com/tildeio/rsvp.js). If you're wanting extra features and more debugging options, check out the [full library](https://github.com/tildeio/rsvp.js).

For API details and how to use promises, see the <a href="http://www.html5rocks.com/en/tutorials/es6/promises/">JavaScript Promises HTML5Rocks article</a>.

## Notes

The main target: implementation should be conformance with browser's implementations and to be minimal as possible in size. So it's strictly polyfill of ES6 Promise specification and nothing more.

It passes both [Promises/A+ test suite](https://github.com/promises-aplus/promises-tests) and [rsvp.js test suite](https://github.com/jakearchibald/es6-promise/tree/master/test). And as small as 2,6KB min (or 1KB min+gzip).

The polyfill uses `setImmediate` if available, or fallback to use `setTimeout`. Use [setImmediate polyfill](https://github.com/YuzuJS/setImmediate) by @YuzuJS to reach better performance.

## How to use

### Browser

To install:

```sh
bower install es6-promise-polyfill
```

To use:

```htmpl
<script src="bower_components/es6-promise-polyfill/promise.min.js"></script>
<script>
  var promise = new Promise(...);
</script>
```

### Node.js

To install:

```sh
npm install es6-promise-polyfill
```

To use:

```js
var Promise = require('es6-promise-polyfill').Promise;
var promise = new Promise(...);
```

## Usage in IE<9

`catch` is a reserved word in IE<9, meaning `promise.catch(func)` throws a syntax error. To work around this, use a string to access the property:

```js
promise['catch'](function(err) {
  // ...
});
```

Or use `.then` instead:

```js
promise.then(undefined, function(err) {
  // ...
});
```

## License

Licensed under the MIT License.

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