New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

asyncctx

Package Overview
Dependencies
Maintainers
1
Versions
54
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

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
939
increased by7.81%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status npm version Dependency Status devDependency Status

node-async-context

This module allows you to create a asynchronouse execution context for JavaScript or TypeScript

NOTE: This module is based on async-hook, which in turn is based on the undocumented API AsyncWrap

This is the reason why async-hook will show this warning on startup:

WARNING: 'you are using async-hook which is unstable.'

NOTE: Your contribution is highly welcome!

Introduction

To give you an idea of how node-async-context is supposed to be used:


import { ContinuationLocalStorage } from 'asyncctx';

class MyLocalStorage {
  value: number;
}

let cls = new ContinuationLocalStorage<MyLocalStorage>();

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

License

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

Release Notes

ReleaseNotes
0.0.1initial version

Downloads

NPM

FAQs

Package last updated on 22 Dec 2016

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