Skip to content

Instantly share code, notes, and snippets.

View NookDev's full-sized avatar

Nook Development NookDev

View GitHub Profile
@xincici
xincici / throttle-debounce
Created May 29, 2015 08:25
throttle and debounce functions extracted from underscore.js
(function(){
var _ = {};
_.now = Date.now || function(){
return new Date().getTime();
};
// Returns a function, that, when invoked, will only be triggered at most once
// during a given window of time. Normally, the throttled function will run
// as much as it can, without ever going more than once per `wait` duration;