repod/src/utils/debounce.js
Michel Roux 47e44bdaf5
All checks were successful
repod / xml (push) Successful in 35s
repod / php (push) Successful in 1m0s
repod / nodejs (push) Successful in 2m25s
repod / release (push) Has been skipped
feat: add download size on modal download button
2024-01-14 00:19:53 +01:00

13 lines
274 B
JavaScript

// https://stackoverflow.com/a/53486112
export const debounce = (fn, delay) => {
let timeoutID = null
return function() {
clearTimeout(timeoutID)
const args = arguments
const that = this
timeoutID = setTimeout(function() {
fn.apply(that, args)
}, delay)
}
}