1.0.1 • Published 6 years ago

@nthlytics/observable-promise v1.0.1

Weekly downloads
62
License
ISC
Repository
github
Last release
6 years ago

observable-promises

A function that takes an executor and wraps it in a Promise with observable state.

Usage

const executor = (resolve, reject) => { 
  resolve('I win'); 
};

const p = new ObservablePromise(executor);
await p;

Properties

An ObservablePromise has the following properties:

  • isResolved: false until the promise resolves
  • isRejected: false until the promise rejects
  • isPending: true until the promise resolves or rejects