processing-context
v1.0.0
Published
Globally accessible processing context based on async_hooks
Downloads
443
Readme
processing-context
Globally accessible processing context based on async_hooks
Install
npm i processing-context
Usage
const processingContext = require("processing-context");
const defaultContext = processingContext.defaultContext;
/*...*/
const key = "counter";
const initialValue = 3;
/*...*/
processingContext.create().set(key, initialValue);
const updatedValue = await new Promise(resolve => resolve(defaultContext.get(key) + 2));