@isaacs/promise-tracker
v1.0.0
Published
This is a way to track the results of a promise, without obscuring `unhandledrejection` events, or losing other added properties that may exist on the promise being tracked.
Readme
@isaacs/promise-tracker
This is a way to track the results of a promise, without
obscuring unhandledrejection events, or losing other added
properties that may exist on the promise being tracked.
It does not return the actual object, because it's impossible
to do that without modifying unhandledrejection behavior, while
also getting a view on the error being raised by the original
promise.
USAGE
import { promiseTracker } from '@isaacs/promise-tracker'
promiseTracker(somePromise, (value) => {
// log the value or whatever
}, (error) => {
// report the error somewhere
})