diff options
Diffstat (limited to 'javascript/helpers.js')
-rw-r--r-- | javascript/helpers.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/javascript/helpers.js b/javascript/helpers.js new file mode 100644 index 00000000..1b26931f --- /dev/null +++ b/javascript/helpers.js @@ -0,0 +1,13 @@ +// helper functions + +function debounce(func, wait_time) { + let timeout; + return function wrapped(...args) { + let call_function = () => { + clearTimeout(timeout); + func(...args) + } + clearTimeout(timeout); + timeout = setTimeout(call_function, wait_time); + }; +}
\ No newline at end of file |