2
0
mirror of https://github.com/tenrok/vue-json-viewer.git synced 2026-05-15 11:59:40 +03:00
Files
vue-json-viewer/lib/utils.js
T
2019-06-12 19:37:52 +08:00

14 lines
297 B
JavaScript

export const debounce = function(func, wait) {
let startTime = Date.now();
let timer;
return (...args) => {
if (Date.now() - startTime < wait && timer) {
clearTimeout(timer);
}
timer = setTimeout(() => {
func(...args);
}, wait);
startTime = Date.now();
}
}