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:
Cam Wiegert
2018-01-04 15:07:50 -06:00
committed by GitHub
parent 0273cb2a20
commit 7f8cf42773
8 changed files with 109 additions and 16 deletions

View File

@ -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);
};
}