diff options
Diffstat (limited to 'web/assets/js/util')
| -rw-r--r-- | web/assets/js/util/common.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/web/assets/js/util/common.js b/web/assets/js/util/common.js index 7225e4ba..b3ebc0bd 100644 --- a/web/assets/js/util/common.js +++ b/web/assets/js/util/common.js @@ -54,4 +54,16 @@ function addZero(num) { function toFixed(num, n) { n = Math.pow(10, n); return Math.round(num * n) / n; -}
\ No newline at end of file +} + +function debounce (fn, delay) { + var timeoutID = null + return function () { + clearTimeout(timeoutID) + var args = arguments + var that = this + timeoutID = setTimeout(function () { + fn.apply(that, args) + }, delay) + } + }
\ No newline at end of file |
