currently-rejected

0.2.0 • Public • Published

currently-rejected Build Status Coverage Status

Track the list of currently rejected promises.

Install

$ npm install --save currently-rejected

Usage

const currentlyRejected = require('currently-rejected')(); // <- note the invocation

var fooError = new Error('foo');
var p = Promise.reject(new Error('foo'));

// on the next tick - unhandled rejected promise is added to the list:
currentlyRejected();
//=> [{promise: p, reason: fooError}]'

p.catch(() => {});

// on the next tick - handled promise is now removed from the list:
currentlyRejected();
//=> [];

API

currentlyRejected()

Returns an array of objects with promise and reason properties. The list is updated as unhandledRejections are published, and later handled.

License

MIT © James Talmage

Package Sidebar

Install

npm i currently-rejected

Weekly Downloads

0

Version

0.2.0

License

MIT

Last publish

Collaborators

  • jamestalmage