parole

2.0.28 • Public • Published

Parole

Promises/A+ logo

Another ES6 promise implementation (compliant with Promises/A+)

ᴋɪʟᴛ ᴊs npm Build Status codecov GitHub license

Installation

npm install parole

# alternatively you can use bower (minified version by default)
yarn add parole

ES6 fulfill

Parole implements ES6 Promise specs

Implements:

  • Promise.prototype.then
  • Promise.prototype.catch
  • Promise.prototype.finally

Also static methods

  • Promise.resolve
  • Promise.reject
  • Promise.all
  • Promise.allSettled
  • Promise.any
  • Promise.race

Includes:

  • Promise.defer
// parole respects the es6 promise specification
// you can use parole as global polyfill

if( !window.Promise ) {
  window.Promise = Parole;
}

Example

new Parole((resolve, reject) => {
    resolve('gogogo!')
  })

  .then((result) => {
    console.log('checkpoint 1', result)
    throw 'whoops!'
  })

  .then(
    (result) => {
      console.log('checkpoint 2', result)
    },
    (result) => {
      console.log('checkpoint 2.1', result)
      return new Parole((resolve, reject) => {
        setTimeout(() => resolve('all right!'), 400)
      })
    },
  )

  .then(
    (result) => console.log('checkpoint 3', result),
    (reason) => console.log('checkpoint 3.1', reason),
  )
;

output

checkpoint 1 gogogo!
checkpoint 2.1 whoops!
# elapsed 400ms
checkpoint 3 all right!

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.0.2813latest

Version History

VersionDownloads (Last 7 Days)Published
2.0.2813
2.0.270
2.0.260
2.0.250
2.0.240
2.0.230
2.0.220
2.0.200
2.0.150
2.0.140
2.0.120
2.0.110
2.0.100
2.0.90
2.0.80
2.0.70
2.0.60
2.0.50
2.0.40
2.0.30
2.0.20
2.0.10
2.0.00
1.1.3030
1.1.290
1.1.247
1.1.230
1.1.220
1.1.210
1.1.200
1.1.190
1.1.180
1.1.1763
1.1.160
1.1.140
1.1.110
1.1.100
1.1.90
1.1.80
1.1.70
1.1.50
1.1.40
1.1.30
1.1.20
1.0.10
1.0.00

Package Sidebar

Install

npm i parole

Weekly Downloads

113

Version

2.0.28

License

MIT

Unpacked Size

29.8 kB

Total Files

16

Last publish

Collaborators

  • jgermade