shabd-logo

Markandey's Blog

1 सितम्बर 2017

126 बार देखा गया 126

Javascript IO is asynchronous, which is awesome but sometime you might land into a situation where you wanted to call several asynchronous function and when all of them are ready you have to perform some action. Obviously you can not nest each other with anonymous functions in all situations.

so intead of doing this (assume u need to call several asyncCalls 1,2,3 etc,)

         asyncCall1(param1,function(output1){asyncCall2(param2,function(output2){asyncCall3(....)})})

You might like to do this

    function finalCallback(alloutput){//here is your final output}cbGenerator=getGroupCallBackGenerator(timeout,finalcallback);asyncCall1(param1,cbGenerator.getCallback('asyncCall1'))asyncCall2(param2,cbGenerator.getCallback('asyncCall2'))asyncCall3(param3,cbGenerator.getCallback('asyncCall3'))asyncCall4(param4,cbGenerator.getCallback('asyncCall4'))cbGenerator.start();

Well You can do it if you want to use my utility function here.

Markandey's Blog

Ankit Markandey की अन्य किताबें

1

जय

1 सितम्बर 2017
0
0
0

Javascript IO is asynchronous, which is awesome but sometime you might land into a situation where you wanted to call several asynchronous function and when all of them are ready you have to perform some action. Obviously you can not nest e

2

Markandey's Blog

1 सितम्बर 2017
0
0
0

Javascript IO is asynchronous, which is awesome but sometime you might land into a situation where you wanted to call several asynchronous function and when all of them are ready you have to perform some action. Obviously you can not nest each other with anonymous funct

3

करवा चौथ पर करे यह उपाय बढेगा मानसम्मान प्रेम

7 अक्टूबर 2017
0
2
0

राज योग में होगा शिव परिवार पूजन , चंद्रमा को देंगे अर्घ्य पं अंकित मार्कण्डेय के मुताबिक कार्तिक मास की कृष्ण पक्ष की चतुर्थी तिथि संकष्टी चतुर्थी को करवा चौथ का व्रत किया जाता है जोकि 8 अक्टूबर, रविवार को है ...विवाहित महिलाएं इस दिन अपने पति की दीर्घायु एवं स्वास्थ्य की कामना हेतु साथ-ही कुंवारी

---

किताब पढ़िए

लेख पढ़िए