throttle2<T, E> method
Implementation
void Function(T t, E e) throttle2<T, E>({int milliseconds = 500}) {
var isAllowed = true;
Timer? throttleTimer;
return (t, e) {
if (!isAllowed) return;
isAllowed = false;
this(t,e);
throttleTimer?.cancel();
throttleTimer = Timer(Duration(milliseconds: milliseconds), () {
isAllowed = true;
});
};
}