This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var throttle = function(fn, wait) { | |
var start = 0, remain = 0; | |
return function() { | |
var self = this, args = arguments; | |
remain = Date.now() - start; | |
if (remain >= wait) { | |
start = Date.now(); | |
setTimeout(function() { | |
fn.apply(self, args); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function requestMultiUrls(urlArray) { | |
"use strict"; | |
var config = { | |
limit: 6 | |
}; // Each send request limit | |
var limit = config.limit, | |
cursor = 0, | |
index = 0; | |
function toRequest(urls, len) { | |
if (len) limit = len; |
NewerOlder