1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-24 00:35:59 +00:00
pixelfed/resources/assets/js/util/debounce.js

12 lines
246 B
JavaScript
Raw Normal View History

2023-10-23 06:15:53 +00:00
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)
}
}