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:
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user