Promise

Basic JS Promise Implementation for funzzies Open to suggestions for improvements.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
Promise
1.0.57 years ago7 years agoMinified + gzip package size for Promise in KB

Readme

Promise-lite
Basic JS Promise Implementation for funzzies Open to suggestions for improvements.

Npm Module

Install

$ npm install -S Promise

ES6+

import Promise from 'Promise'

ES5

var Promise = require('Promise').default

About

Supports .then chaining and async resolution/rejection.

Development

Install

$ git clone <project>
$ npm install
$ npm run dev //edit src folder

Build

$ npm run build

Example

import Promise from 'Promise'

const p = new Promise((resolve, reject) => {
    setTimeout(() => resolve(5), 1000)
})
.then((fulfilled) => {
  console.log('fulfilled', fulfilled)
  return "success"
}, (rejected) => {
  console.log('rejected ', rejected)
})
.then((fulfilled) => {
  console.log('fulfilled 2 ', fulfilled)
}, (rejected) => {
  console.log('rejected 2 ', rejected)
})