tangram
Version:
WebGL Maps for Vector Tiles
15 lines (14 loc) • 408 B
JavaScript
// Debounce a function
// https://davidwalsh.name/javascript-debounce-function
export default function debounce (func, wait) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
func.apply(context, args);
};
clearTimeout(timeout);
timeout = setTimeout(later, wait);
};
}