0.0.1 • Published 5 years ago

async-hooks-node v0.0.1

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

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.