Extendable Promise
Allows extension of JavaScript's standard, built-in Promise
class.
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';
How to use
class MyPromise extends ExtendablePromise {
}
const myPromise = new MyPromise((resolve, reject) => {
console.log('executed', resolve, reject);
});
console.log(myPromise instanceof Promise);
myPromise.execute();
myPromise.then(result => {
console.log(result);
});
myPromise.resolve(123);
Notes