0.0.1 • Published 4 years ago
async-hooks-node v0.0.1
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.
0.0.1
4 years ago