队列示例
var array = [1,2,3,4]; function check() { if(array.length > 0) var url = array.pop(); load(url); }} function load(url) { http.get(url, function(res){ check(); ) }}
我想在 每次load(url)的时候 延迟6秒 这时候我用setTimeout 没什么效果
认证0级讲师
Use sleep
It’s best to format it when sending the code! Dear
If you use setTimeout to implement it, you need to recurse
The timing function can be written like this
var a = function(){ //逻辑 setTimeout(() => { a() }, time) }
I don’t know if that’s what you want
Use sleep
It’s best to format it when sending the code! Dear
If you use setTimeout to implement it, you need to recurse
The timing function can be written like this
I don’t know if that’s what you want