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

asynccode

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asynccode

Make a code block async, overcome the 'max call stack exceeded' error

  • 0.0.3
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

asyncCode

Creates a new call stack for a code block

For use in nodejs:

npm install asynccode --save

Now for every async code block'

/* uncomment for use with nodejs */
// var requirejs = require('requirejs');
// requirejs.config({
//   nodeRequire: require
// });

requirejs(['../asynccode'],function(async){
  var max = 1024 * 1024;
  var i = 0;

  var next = function(){
    if(i < max){
      async(function(){
        // .. do your async thing
        Math.sqrt(i);
        i++;
        next();
      });
    }else{
      console.log('ready'); // eslint-disable-line
    }
  };
  next();
});

const myAsyncFunc = function(callback){
  // Function scope/codeblock
  asyncCode(
    // This is executed in another code block
    function(){
      // Do your async thing
      // ....
      // .....
      callback('ok');
    }
  );
  return this;
}


Keywords

FAQs

Package last updated on 20 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