2
0
mirror of https://github.com/tenrok/vue-json-viewer.git synced 2026-06-20 20:00:37 +03:00

Support for incremental update components

This commit is contained in:
陈峰
2019-06-12 19:37:52 +08:00
parent 6e7c4eb113
commit 6b09e02ac8
4 changed files with 74 additions and 9 deletions
+14
View File
@@ -0,0 +1,14 @@
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();
}
}