An Async Hooks polyfill for Node < 8, written in TypeScript.
The idea is to provide an interface identical to the native Async Hooks implementation in older versions of Node. If you
import the library in Node 8+ it will return the native Async Hooks, otherwise it will return the polyfill.
The docs for Async Hooks here.
This implementation is based largely on the work of Andreas Madsen
$ npm install --save @creditkarma/async-hooks
Creates a new
AsyncHook object with the supplied callbacks
In the native implementation of Async Hooks the
resource received by the
init method is the async object that was created. In the polyfill this
resource is likely to not useful and is here for completeness. Usually this will be an empty wrapper object.
Returns the unique ID of the currently executing async context.
Returns the unique ID of the parent context for the currently executing async context.