async-hooks-node
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

NPM version node version npm download npm license

async hooks node

track async-hooks execution as linked-list.

API

// export type Node = {
//   parent?: Node
//   asyncId: number
// }
 
import { executionAsyncNode } from 'async-hooks-node';
const node1 = executionAsyncNode()
 
setTimeout(() => {
  const node2 = executionAsyncNode()
  // node2.parent == node1
}, 1);
 

it is easily to implement any thread-local like async-context with extending Node or using WeakMap.

/async-hooks-node/

    Package Sidebar

    Install

    npm i async-hooks-node

    Weekly Downloads

    1

    Version

    0.0.1

    License

    ISC

    Unpacked Size

    6.08 kB

    Total Files

    7

    Last publish

    Collaborators

    • xujif