Buckets:
20.9 GB
673,093 files
Updated about 2 months ago
Ctrl+K
| Name | Size | Uploaded | Xet hash |
|---|---|---|---|
| dist | 4 items | ||
| lib | 2 items | ||
| README.md | 2.17 kB xet | 9a55c4ec | |
| license.md | 1.08 kB xet | f745a76d | |
| lie.d.ts | 12 kB xet | a270b650 | |
| package.json | 2.43 kB xet | f26fb207 | |
| polyfill.js | 97 Bytes xet | 45e1a882 |
lie
[](https://travis-ci.org/calvinmetcalf/lie)
lie is a small, performant promise library implementing the Promises/A+ spec (Version 1.1).
Originally a fork of Ruben Verborgh's promiscuous, with version 2.6 it became a fork of ayepromise by Chris Burgmer.
npm install lie
var Promise = require('lie');
// or use the pollyfill
require('lie/polyfill');
Usage
Either use it with browserify (recommended) or grab one of the files from the dist folder:
- lie.js/lie.min.js exposes 'Promise' either as a UMD module or from the global scope, depending on if a CJS or AMD loader is available.
- lie.polyfill.js/lie.polyfill.min.js adds 'Promise' to the global scope only if it's not already defined (not a UMD).
API
Implements the standard ES6 api:
new Promise(function(resolve, reject){
doSomething(function(err, result) {
if (err) {
reject(err);
} else {
resolve(result);
}
});
}).then(function (value) {
//on success
}, function (reason) {
//on error
}).catch(function (reason) {
//shortcut for error handling
});
Promise.all([
//array of promises or values
]).then(function ([/* array of results */]));
Promise.race([
//array of promises or values
]);
// either resolves or rejects depending on the first value to do so
Unhandled Rejections
In Node.js, lie emits an unhandledRejection event when a rejected promise isn't caught, in line with how io.js does it. This allows it to act as a promise shim in both Node.js and the browser.
- Total size
- 20.9 GB
- Files
- 673,093
- Last updated
- Mar 19
- Pre-warmed CDN
- US EU US EU