1年前 -
async/await的出现最初大家写请求是这样写的:res=http.get("a.com")res=http.get("b.com")这样顺序执行,请求速度很慢.于是有人写了线程池,支持并行发请求,api是callback风格:http.get("a.com",function(err,res){//xxx})http.get("b.com",function(err,res){//xxx})但是很快代码就变成了:function(){//...
极客ryan-weixin.qq.com - 2024-01-24