node.js - Test if a function is asynchronous or not? -
i want test whether function in node.js asynchronous or not?
the author of module says asynchronous want sure. hoping there way find out if asynchronous or not. how can check whether asynchronous or not?
here's simple way test if code async: modify variable in callback , check if has changed after function call:
var async_check = 0; maybe_async(function(){ async_check = 1; }); if(async_check){ console.log("maybe_async synchronous"); } else { console.log("maybe_async asynchronous"); }
Comments
Post a Comment