// Not the best, but doesn't have <any> types,
// the `let timer` has, but the eslint won't complicate
export default function (fn: () => void, delay = 300) {
let timer
return (() => {
clearTimeout(timer)
timer = setTimeout(() => fn(), delay)
})()
}