Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/litichevskiydv/processing-context
Globally accessible processing context based on async_hooks
https://github.com/litichevskiydv/processing-context
Last synced: 8 days ago
JSON representation
Globally accessible processing context based on async_hooks
- Host: GitHub
- URL: https://github.com/litichevskiydv/processing-context
- Owner: litichevskiydv
- License: mit
- Created: 2019-10-10T16:29:58.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T02:26:55.000Z (about 2 years ago)
- Last Synced: 2024-12-20T17:43:24.773Z (19 days ago)
- Language: JavaScript
- Size: 451 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# processing-context
[![npm version](https://badge.fury.io/js/processing-context.svg)](https://www.npmjs.com/package/processing-context)
[![npm downloads](https://img.shields.io/npm/dt/processing-context.svg)](https://www.npmjs.com/package/processing-context)
[![dependencies](https://img.shields.io/david/litichevskiydv/processing-context.svg)](https://www.npmjs.com/package/processing-context)
[![dev dependencies](https://img.shields.io/david/dev/litichevskiydv/processing-context.svg)](https://www.npmjs.com/package/processing-context)
[![Build Status](https://travis-ci.org/litichevskiydv/processing-context.svg?branch=master)](https://travis-ci.org/litichevskiydv/processing-context)
[![Coverage Status](https://coveralls.io/repos/github/litichevskiydv/processing-context/badge.svg?branch=master)](https://coveralls.io/github/litichevskiydv/processing-context?branch=master)Globally accessible processing context based on async_hooks
# Install
`npm i processing-context`
# Usage
```javascript
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));
```