UNPKG

tangram

Version:
15 lines (14 loc) 408 B
// 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); }; }