Skip to content

Instantly share code, notes, and snippets.

View hussion's full-sized avatar

嫣识 hussion

  • Alibaba
  • Hangzhou, China
View GitHub Profile
@hussion
hussion / throttle-debounce.js
Last active August 29, 2015 14:24
throttle&debounce
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);
@hussion
hussion / requestMultiUrls.js
Last active August 29, 2015 14:21
发送海量请求流程处理
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;