debounce = function(fn, duration) {

	let timeout = null

	return (...args) => {

		clearTimeout(timeout)

		timeout = setTimeout(() => fn(...args), duration)

	}

}
Debounces a function that will be triggered many times.
@param {Function} fn
@param {Number} duration
@returns {Function}