2.0.28 • Published 10 months ago

parole v2.0.28

Weekly downloads
353
License
MIT
Repository
github
Last release
10 months ago

Parole

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!
2.0.28

10 months ago

2.0.27

11 months ago

2.0.26

1 year ago

2.0.24

1 year ago

2.0.25

1 year ago

2.0.22

1 year ago

2.0.23

1 year ago

2.0.20

1 year ago

2.0.15

1 year ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.5

2 years ago

2.0.14

1 year ago

2.0.4

2 years ago

2.0.11

2 years ago

2.0.7

2 years ago

2.0.12

2 years ago

2.0.6

2 years ago

2.0.9

2 years ago

2.0.10

2 years ago

2.0.8

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.1.30

5 years ago

1.1.29

5 years ago

1.1.24

6 years ago

1.1.23

6 years ago

1.1.22

6 years ago

1.1.21

6 years ago

1.1.20

6 years ago

1.1.19

6 years ago

1.1.18

6 years ago

1.1.17

6 years ago

1.1.16

6 years ago

1.1.14

6 years ago

1.1.11

6 years ago

1.1.10

6 years ago

1.1.9

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago