sjasync

sudo npm install sjasync

Usage no npm install needed!

<script type="module">
  import sjasync from 'https://cdn.skypack.dev/sjasync';
</script>

README

SJASYNC

Node jS Async Implementation.

Right Now i just did Parallel Function implementation. I test this with 1000000 calling its 2000ms faster then other libraries.

Installation

sudo npm install sjasync

Functions


    var async = require("sjasync");
    
    // asynch.parallel(rules,done,every);
    
    // rules Could be Array or Map, 
    // "done" is final "Function" that will get called after all function get executed inside of rules
    // "every" is "Function" that will get called on every function executed inside of rules, its a optional function
    
    async.parallel({
        first: function(callback){
            setTimeout(function(){
                callback(null,{data:"Data First"})
            },500);
        },
        second: function(callback){
           setTimeout(function(){
               callback(null,{data:"Data Second"})
           },100);
       }
    }, function(err,results){
        
    });
    
    async.parallel({
        first: function(callback){
            setTimeout(function(){
                callback(null,{data:"Data First"})
            },500);
        },
        second: function(callback){
           setTimeout(function(){
               callback(null,{data:"Data Second"})
           },100);
       }
    }, function(err,results){
        
    },function(err,result,key){
    
    });
        
    async.parallel([
        function(callback){
            setTimeout(function(){
                callback(null,{data:"Data First"})
            },500);
        },
        function(callback){
           setTimeout(function(){
               callback(null,{data:"Data Second"})
           },100);
       }
    ], function(err,results){
        
    });
        
    async.parallel([
        function(callback){
            setTimeout(function(){
                callback(null,{data:"Data First"})
            },500);
        },
        function(callback){
           setTimeout(function(){
               callback(null,{data:"Data Second"})
           },100);
       }
    ], function(err,results){
        
    },function(err,result,key){
        // Here Key will be index
    });