mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 20:33:32 +08:00
feat(inputs) debounce input and change events (#13764)
* feat(helpers) add debounce helper * feat(searchbar) debounce ionInput * feat(range) debounce ionChange * feat(input) debouce ionInput * feat(textarea) debounce ionInput * feat(range) make debounceChange private * feat(searchbar) make debounceInput private * feat(inputs) change default debounce to 0 in input/textarea
This commit is contained in:
@ -295,3 +295,11 @@ export function domControllerAsync(domControllerFunction: Function, callback?: F
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export function debounce(func: Function, wait: number = 250) {
|
||||
let timer: number;
|
||||
return (...args: any[]): void => {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(func, wait, ...args);
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user