Add js debounce util

This commit is contained in:
Daniel Supernault 2023-10-23 00:15:53 -06:00
parent a144301085
commit 4e3e23db36
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1

11
resources/assets/js/util/debounce.js vendored Normal file
View file

@ -0,0 +1,11 @@
export function debounce (fn, delay) {
var timeoutID = null
return function () {
clearTimeout(timeoutID)
var args = arguments
var that = this
timeoutID = setTimeout(function () {
fn.apply(that, args)
}, delay)
}
}