Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
es6-promise-polyfill
Advanced tools
This is a polyfill of ES6 Promise. The implementation based on Jake Archibald implementation a subset of rsvp.js. If you're wanting extra features and more debugging options, check out the full library.
For API details and how to use promises, see the JavaScript Promises HTML5Rocks article.
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 and rsvp.js test suite. 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 by @YuzuJS to reach better performance.
To install:
bower install es6-promise-polyfill
To use:
<script src="bower_components/es6-promise-polyfill/promise.min.js"></script>
<script>
var promise = new Promise(...);
</script>
To install:
npm install es6-promise-polyfill
To use:
var Promise = require('es6-promise-polyfill').Promise;
var promise = new Promise(...);
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:
promise['catch'](function(err) {
// ...
});
Or use .then
instead:
promise.then(undefined, function(err) {
// ...
});
Licensed under the MIT License.
1.2.0 (December 8, 2015)
FAQs
Polyfill for ES6 Promise
The npm package es6-promise-polyfill receives a total of 32,607 weekly downloads. As such, es6-promise-polyfill popularity was classified as popular.
We found that es6-promise-polyfill demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.