Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

asyncctx

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asyncctx

an asynchronous execution context for TypeScript/JavaScript

  • 1.1.11
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1K
decreased by-6.07%
Maintainers
1
Weekly downloads
 
Created
Source

npm version Known Vulnerabilities Build Status Coverage Status Dependency Status Greenkeeper badge

node-async-context (asyncctx)

This module allows you to create an asynchronous execution context for JavaScript or TypeScript

NOTE: This module is based on async_hooks an experimental built-in node.js module introduced in v8.0.0

NOTE: Your contribution is highly welcome!

Introduction

To give you an idea of how asyncctx is supposed to be used:

import { ContinuationLocalStorage } from 'asyncctx';

class MyLocalStorage {
  value: number;
}

let cls = new ContinuationLocalStorage<MyLocalStorage>();
cls.setRootContext({ value: 1});

process.nextTick(() => {
  let curr1 = cls.getContext(); // value is 1
  cls.setContext({ value: 2});  // value should be 2 in the current execution context and below
  process.nextTick(() => {
    let curr2 = cls.getContext(); // value is 2
    cls.setContext({ value: 3});  // value should be 3 in the current execution context and below
    process.nextTick(() => {
      let curr3 = cls.getContext(); // value is 3
    });
  });
  process.nextTick(() => {
    let curr4 = cls.getContext(); // value is 2
  });
});

License

node-async-context (asyncctx) is licensed under the MIT License: LICENSE

Release Notes

ReleaseNotes
1.1.11node 14
1.1.8-10maintenance release
1.1.7node 13
1.1.2-6maintenance release
1.1.1fixed loosing context; thanks to Pasi Tuominen
2.0.0targeting es6; dropped support for nodejs < v8
please use asyncctx@<2.0 for nodejs v4 - v11 support
1.1.0fixed support for nodes < v8
1.0.5-10maintenance release
1.0.4node 10
1.0.3node 9
1.0.2maintenance release
1.0.1added support for older nodejs versions (4,6,7) using internal copy of async-hook@1.7.1
1.0.0is now based on 'async_hooks' (a built-in nodejs v8.0 module)
0.0.6maintenance releases
0.0.5async-hook 1.7.1
0.0.1-4initial version

FAQs

Package last updated on 17 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc