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
1 changed files with 11 additions and 0 deletions

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)
}
}