Skip to content

Lightweight promise polyfill for the browser and node. A+ Compliant

License

Notifications You must be signed in to change notification settings

aiannacc/promise-polyfill

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Promises/A+ logo Promise [![Build Status](https://travis-ci.org/taylorhakes/promise-polyfill.png?branch=master)](https://travis-ci.org/taylorhakes/promise-polyfill) ![https://david-dm.org/taylorhakes/promise-polyfill/dev-status.png](https://david-dm.org/taylorhakes/promise-polyfill/dev-status.png) =============

Lightweight promise polyfill for the browser and node. A+ Compliant. It is a perfect polyfill IE, Firefox or any other browser that does not support native promises.

This implementation is based on then/promise. It has been changed to use the prototype for performance and memory reasons.

For API information about Promises, please check out this article HTML5Rocks article.

It is extremely lightweight. < 1kb Gzipped

Downloads

Node

npm install promise-polyfill

Simple use

var prom = new Promise(function(resolve, reject) {
  // do a thing, possibly async, then…

  if (/* everything turned out fine */) {
    resolve("Stuff worked!");
  }
  else {
    reject(new Error("It broke"));
  }
});

// Do something when async done
prom.then(function() {
  ...
});

Testing

npm install
npm test

License

MIT

About

Lightweight promise polyfill for the browser and node. A+ Compliant

Resources

License

Stars

Watchers

Forks

Packages

No packages published