I am trying to use debounce on an action I have managed to do that however I want to pass e through as a parameter but it is not working. Is there any way I could do this?
constructor(props, context) {
super(props, context);
this.testing = _.debounce(this.testing.bind(this), 2000);
}
@action testing(e) {
alert("debounced!!");
//use e.target ...
}
If I take away e it will get into the function otherwise not. What should I do to resolve this?
After assigning
this.testing
,in some event you should call that method with parameter
something like this
You can make use of event.persist() to pass on the event to the debounce method.
According to the DOCS:
So you can use the event as