1.0.15 • Published 2 years ago

@js-bits/xpromise v1.0.15

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Extendable Promise

Allows extension of JavaScript's standard, built-in Promise class and decouples an asynchronous operation that ties an outcome to a promise from the constructor.

Installation

Install with npm:

npm install @js-bits/xpromise

Install with yarn:

yarn add @js-bits/xpromise

Import where you need it:

import ExtendablePromise from '@js-bits/xpromise';

or require for CommonJS:

const ExtendablePromise = require('@js-bits/xpromise');

How to use

class MyPromise extends ExtendablePromise {
  // do whatever you need
}

const myPromise = new MyPromise((resolve, reject) => {
  console.log('executed', resolve, reject);
});
console.log(myPromise instanceof Promise); // true
myPromise.execute(); // 'executed' [Function (anonymous)] [Function (anonymous)]
myPromise.then(result => {
  console.log(result); // 123
});
myPromise.resolve(123);

Notes

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.15

2 years ago

0.3.2

2 years ago

1.0.14

2 years ago

0.3.1

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

0.3.3

2 years ago

0.3.0

3 years ago

0.2.2

3 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.0

4 years ago

0.1.1

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago