MCPcopy
hub / github.com/stefanpenner/es6-promise

github.com/stefanpenner/es6-promise @v4.2.8 sqlite

repository ↗ · DeepWiki ↗ · release v4.2.8 ↗
65 symbols 154 edges 23 files 3 documented · 5%
README

ES6-Promise (subset of rsvp.js) Build Status

This is a polyfill of the ES6 Promise. The implementation is a subset of rsvp.js extracted by @jakearchibald, 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.

Downloads

CDN

To use via a CDN include this in your html:


<script src="https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.js"></script>
<script src="https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.js"></script> 


<script src="https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.min.js"></script> 

Node.js

To install:

yarn add es6-promise

or

npm install es6-promise

To use:

var Promise = require('es6-promise').Promise;

Usage in IE<9

catch and finally are reserved keywords in IE<9, meaning promise.catch(func) or promise.finally(func) throw a syntax error. To work around this, you can use a string to access the property as shown in the following example.

However most minifiers will automatically fix this for you, making the resulting code safe for old browsers and production:

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

Auto-polyfill

To polyfill the global environment (either in Node or in the browser via CommonJS) use the following code snippet:

require('es6-promise').polyfill();

Alternatively

require('es6-promise/auto');

Notice that we don't assign the result of polyfill() to any variable. The polyfill() method will patch the global environment (in this case to the Promise name) when called.

Building & Testing

You will need to have PhantomJS installed globally in order to run the tests.

npm install -g phantomjs

  • npm run build to build
  • npm test to run tests
  • npm start to run a build watcher, and webserver to test
  • npm run test:server for a testem test runner and watching builder

Extension points exported contracts — how you extend this code

Thenable (Interface)
(no doc)
es6-promise.d.ts

Core symbols most depended-on inside this repo

then
called by 79
es6-promise.d.ts
resolve
called by 39
lib/es6-promise/-internal.js
reject
called by 20
lib/es6-promise/-internal.js
all
called by 10
lib/es6-promise/promise/all.js
fulfill
called by 9
lib/es6-promise/-internal.js
assertRejection
called by 6
test/extension-test.js
asap
called by 5
lib/es6-promise/asap.js
catch
called by 4
lib/es6-promise/promise.js

Shape

Function 49
Method 9
Class 6
Interface 1

Languages

TypeScript100%

Modules by API surface

lib/es6-promise/-internal.js17 symbols
lib/es6-promise/asap.js10 symbols
lib/es6-promise/enumerator.js8 symbols
lib/es6-promise/promise.js7 symbols
test/extension-test.js5 symbols
es6-promise.d.ts4 symbols
Brocfile.js4 symbols
lib/es6-promise/utils.js3 symbols
test/test-adapter.js1 symbols
lib/es6-promise/then.js1 symbols
lib/es6-promise/promise/resolve.js1 symbols
lib/es6-promise/promise/reject.js1 symbols

Dependencies from manifests, versioned

babel-plugin-transform-es2015-arrow-functions6.22.0 · 1×
babel-plugin-transform-es2015-block-scoping6.24.1 · 1×
babel-plugin-transform-es2015-classes6.24.1 · 1×
babel-plugin-transform-es2015-computed-properties6.24.1 · 1×
babel-plugin-transform-es2015-constants6.1.4 · 1×
babel-plugin-transform-es2015-destructuring6.23.0 · 1×
babel-plugin-transform-es2015-parameters6.24.1 · 1×
babel-plugin-transform-es2015-shorthand-properties6.24.1 · 1×
babel-plugin-transform-es2015-spread6.22.0 · 1×
babel-plugin-transform-es2015-template-literals6.22.0 · 1×
babel6-plugin-strip-class-callcheck6.0.0 · 1×
broccoli-babel-transpiler6.0.0 · 1×

For agents

$ claude mcp add es6-promise \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact