node.js - Calling a function which has inside async statements (should I use process.nextTick in parent ?) -
suppose have following code:
foo();  function foo() {    func1("bla", function() {                 console.log("done!");                }); }  function func1(value,callback) {        process.nexttick(callback); } will function above totally async ? or should use foo function? :
function foo() {     process.nexttick(function() {                            func1("bla", function() {                           console.log("done!");                      }); } actually question if parent blocks child process being async ?
the first option going "async" in sense node might other things before calling callback method.
there no need call second method. foo function finishes , parent callers of foo finish node start doing other work, work registered nexttick.
Comments
Post a Comment