/
eb
/
Surf
Обзор
Документация
Войти
/
eb
/
Surf
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
node_modules/just-debounce/index.js
34 строки
605 B
EvgeniyBudaev
Initial commit
17 фев 2020, 09:02
17 фев 2020, 09:02
bb6f06f
Код
Авторство
О чём код?
module.exports = debounce function debounce (fn, delay, at_start, guarantee) { var timeout var args var self return function debounced () { self = this args = Array.prototype.slice.call(arguments) if (timeout && (at_start || guarantee)) { return } else if (!at_start) { clear() timeout = setTimeout(run, delay) return timeout } timeout = setTimeout(clear, delay) fn.apply(self, args) function run () { clear() fn.apply(self, args) } function clear () { clearTimeout(timeout) timeout = null } } }