diff --git a/src/utils/commons.js b/src/utils/commons.js index a983295..31e0ef7 100644 --- a/src/utils/commons.js +++ b/src/utils/commons.js @@ -52,16 +52,16 @@ export function prepareUrl(url) { return new UrlBuilder(url) } -export function debounce(fn, delay = 500) { - let timer - return e => { - e.persist() - clearTimeout(timer) - timer = setTimeout(() => { - fn(e) - }, delay) - } -} +// export function debounce(fn, delay = 500) { +// let timer +// return e => { +// e.persist() +// clearTimeout(timer) +// timer = setTimeout(() => { +// fn(e) +// }, delay) +// } +// } export function throttle(fn, delay, atleast) { let timeout = null, @@ -409,19 +409,19 @@ export const stringToColour = (str) => { return colour } -// export const debounce = (func, wait, immediate) => { -// var timeout; -// return function () { -// var context = this, -// args = arguments; -// clearTimeout(timeout); -// if (immediate && !timeout) func.apply(context, args); -// timeout = setTimeout(function () { -// timeout = null; -// if (!immediate) func.apply(context, args); -// }, wait); -// }; -// } +export const debounce = (func, wait, immediate) => { + var timeout; + return function () { + var context = this, + args = arguments; + clearTimeout(timeout); + if (immediate && !timeout) func.apply(context, args); + timeout = setTimeout(function () { + timeout = null; + if (!immediate) func.apply(context, args); + }, wait); + }; +} export const olog = (text, ...args) => { console.log(