1.0.0 • Published 5 years ago
processing-context v1.0.0
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));
1.0.0
5 years ago