mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-27 10:32:58 +02:00
13 lines
336 B
TypeScript
13 lines
336 B
TypeScript
import PoorManIntervals from '@joplin/lib/PoorManIntervals';
|
|
|
|
function debounce(func: (...args: any[])=> void, timeout: number) {
|
|
let timer: number;
|
|
|
|
return (...args: any[]) => {
|
|
PoorManIntervals.clearTimeout(timer);
|
|
timer = PoorManIntervals.setTimeout(() => { func.apply(this, args); }, timeout);
|
|
};
|
|
}
|
|
|
|
export default debounce;
|