1.0.2 • Published 7 years ago

poor-man-promise v1.0.2

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

Poor Man's Promise Implementation

Install

npm install poor-man-promise

Use

var Promise = require('poor-man-promise');

new Promise(function(accept) {
  setTimeout(function() {
    accept(1);
  }, 1000);
})
.then(function(value) {
  return value * 2;
})
.then(function(value) {
  return new Promise(function(accept) {
    setTimeout(function() {
      accept(value + 5);
    }, 1000);
  });
})
.then(function(finalAnswer) {
  console.log('The final answer is ' + finalAnswer);
});

The above prints:

The final answer is 7

Known Issues

Doesn't not support rejections yet.

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago