Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

promise-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

promise-polyfill - npm Package Compare versions

Comparing version 6.1.0 to 7.0.0

dist/polyfill.js

39

package.json
{
"name": "promise-polyfill",
"version": "6.1.0",
"version": "7.0.0",
"description": "Lightweight promise polyfill. A+ compliant",
"main": "promise.js",
"main": "lib/index.js",
"module": "src/index.js",
"unpkg": "dist/promise.min.js",
"files": [
"src",
"lib",
"dist"
],
"scripts": {
"test": "eslint promise.js && mocha && karma start --single-run",
"build": "uglifyjs --compress --support-ie8 --mangle -o promise.min.js -- promise.js "
"precommit": "lint-staged",
"pretest": "npm run build:cjs",
"test": "eslint src && mocha && karma start --single-run",
"prebuild": "rimraf lib dist",
"build": "run-p build:**",
"build:cjs": "rollup -i src/index.js -o lib/index.js -f cjs",
"build:umd": "cross-env NODE_ENV=development rollup -i src/index.js -o dist/promise.js -c rollup.umd.config.js",
"build:umd:min": "cross-env NODE_ENV=production rollup -i src/index.js -o dist/promise.min.js -c rollup.umd.config.js",
"build:cjs-polyfill": "rollup -i src/polyfill.js -o lib/polyfill.js -f cjs",
"build:umd-polyfill": "cross-env NODE_ENV=development rollup -i src/polyfill.js -o dist/polyfill.js -c rollup.umd.config.js",
"build:umd-polyfill:min": "cross-env NODE_ENV=production rollup -i src/polyfill.js -o dist/polyfill.min.js -c rollup.umd.config.js",
"prepublish": "test $(npm -v | tr . '\\n' | head -n 1) -ge '4' || exit 1",
"prepare": "npm run build"
},

@@ -21,3 +39,5 @@ "repository": {

"devDependencies": {
"eslint": "^2.4.0",
"cross-env": "^5.1.1",
"eslint": "^4.11.0",
"husky": "^0.14.3",
"karma": "^0.13.19",

@@ -27,6 +47,11 @@ "karma-browserify": "^4.4.2",

"karma-mocha": "^0.2.1",
"lint-staged": "^5.0.0",
"mocha": "^2.3.4",
"npm-run-all": "^4.1.2",
"prettier": "^1.8.2",
"promises-aplus-tests": "*",
"sinon": "^1.17.2",
"uglify-js": "^2.6.2"
"rimraf": "^2.6.2",
"rollup": "^0.52.0",
"rollup-plugin-uglify": "^2.0.1",
"sinon": "^1.17.2"
},

@@ -33,0 +58,0 @@ "keywords": [

63

README.md
# Promise Polyfill
[![travis][travis-image]][travis-url]

@@ -7,23 +8,31 @@

Lightweight ES6 Promise polyfill for the browser and node. Adheres closely to
the spec. It is a perfect polyfill IE, Firefox or any other browser that does
not support native promises.
Lightweight ES6 Promise polyfill for the browser and node. Adheres closely to the spec. It is a perfect polyfill IE, Firefox or any other browser that does not support native promises.
For API information about Promises, please check out this article
[HTML5Rocks article](http://www.html5rocks.com/en/tutorials/es6/promises/).
For API information about Promises, please check out this article [HTML5Rocks article](http://www.html5rocks.com/en/tutorials/es6/promises/).
It is extremely lightweight. **_< 1kb Gzipped_**
It is extremely lightweight. ***< 1kb Gzipped***
## Browser Support
## Browser Support
IE8+, Chrome, Firefox, IOS 4+, Safari 5+, Opera
### NPM Use
```
npm install promise-polyfill --save-exact
```
### Bower Use
```
bower install promise-polyfill
```
### CDN Use
```
<script href="https://cdn.jsdelivr.net/npm/promise-polyfill@6/promise.min.js"></script>
<script href="https://cdn.jsdelivr.net/npm/promise-polyfill@6/dist/promise.min.js"></script>
```

@@ -33,8 +42,9 @@

- [Promise](https://raw.github.com/taylorhakes/promise-polyfill/master/promise.js)
- [Promise-min](https://raw.github.com/taylorhakes/promise-polyfill/master/promise.min.js)
* [Promise](https://raw.github.com/taylorhakes/promise-polyfill/master/dist/promise.js)
* [Promise-min](https://raw.github.com/taylorhakes/promise-polyfill/master/dist/promise.min.js)
## Simple use
```js
import Promise from 'promise-polyfill';
import Promise from 'promise-polyfill';

@@ -48,2 +58,3 @@ // To add to window

then you can use like normal Promises
```js

@@ -65,15 +76,18 @@ var prom = new Promise(function(resolve, reject) {

## Deprecations
- `Promise._setImmediateFn(<immediateFn>)` has been deprecated. Use `Promise._immediateFn = <immediateFn>;` instead.
- `Promise._setUnhandledRejectionFn(<rejectionFn>)` has been deprecated. Use `Promise._unhandledRejectionFn = <rejectionFn>` instead.
These functions will be removed in the next major version.
## Performance
By default promise-polyfill uses `setImmediate`, but falls back to `setTimeout` for executing asynchronously. If a browser does not support `setImmediate` (IE/Edge are the only browsers with setImmediate), you may see performance issues.
Use a `setImmediate` polyfill to fix this issue. [setAsap](https://github.com/taylorhakes/setAsap) or [setImmediate](https://github.com/YuzuJS/setImmediate) work well.
If you polyfill `window.setImmediate` or use `Promise._immediateFn = yourImmediateFn` it will be used instead of `window.setTimeout`
By default promise-polyfill uses `setImmediate`, but falls back to `setTimeout`
for executing asynchronously. If a browser does not support `setImmediate`
(IE/Edge are the only browsers with setImmediate), you may see performance
issues. Use a `setImmediate` polyfill to fix this issue.
[setAsap](https://github.com/taylorhakes/setAsap) or
[setImmediate](https://github.com/YuzuJS/setImmediate) work well.
If you polyfill `window.setImmediate` or use `Promise._immediateFn =
yourImmediateFn` it will be used instead of `window.setTimeout`
```
npm install setasap --save
```
```js

@@ -86,10 +100,20 @@ var Promise = require('promise-polyfill');

## Unhandled Rejections
promise-polyfill will warn you about possibly unhandled rejections. It will show a console warning if a Promise is rejected, but no `.catch` is used. You can turn off this behavior by setting `Promise._setUnhandledRejectionFn(<rejectError>)`.
If you would like to disable unhandled rejections. Use a noop like below.
promise-polyfill will warn you about possibly unhandled rejections. It will show
a console warning if a Promise is rejected, but no `.catch` is used. You can
change this behavior by doing.
```js
Promise._unhandledRejectionFn = <your reject error handler>;
```
If you would like to disable unhandled rejection messages. Use a noop like
below.
```js
Promise._unhandledRejectionFn = function(rejectError) {};
```
## Testing
## Testing
```

@@ -101,2 +125,3 @@ npm install

## License
MIT
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc