diff options
Diffstat (limited to '')
-rw-r--r-- | src/utils/helpers.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/utils/helpers.js b/src/utils/helpers.js index e847c42..f81190b 100644 --- a/src/utils/helpers.js +++ b/src/utils/helpers.js @@ -28,9 +28,19 @@ const isInt = (value) => { return Number.isInteger(value); } +const debounce = (callback, delay = 300) => { + let timer; + + return function(...args) { + clearTimeout(timer); + timer = setTimeout(() => callback(...args), delay); + } +} + export { copyToClipboard, fileIsImage, formatBytes, - isInt + isInt, + debounce }
\ No newline at end of file |