There is a asynchronous function fun(param, callback)
like this:
fun(param, function(err){
if(err) console.log(err);
doSomething();
});
How do I set a time limit to run this function?
For example, I set time limit equals to 10 secs.
If it finish in 10 seconds, there is no error.
If it run exceed 10 seconds, terminate it and show error.