mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-11 09:04:52 +00:00
12 lines
246 B
JavaScript
12 lines
246 B
JavaScript
|
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)
|
||
|
}
|
||
|
}
|