-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use debouncing function inside watcher? #17
Comments
To my knowledge the watcher should trigger anytime the search_text value is changed, should you be emitting another input even from the watcher? If you want to expand with a little more detail that would be helpful too as I don't think I'm connecting the dots on my end to what your shooting for! |
No worries, so I have a search input which uses a real time search api, in order to cut down on how many queries I'm running I am using this library so that after someone stops typing then the request is fired. I ran into the use-case where if someone clears the input, the event won't be fired immediately but after the same 300ms waiting time and I would prefer that So I first tried to implement just the debounce operation by using the |
OHH okay I see what you mean! In it's current state, I don't think you would be able to achieve that but I could add an option for a new boolean... Something like Would that be something you'd be interested in using for what you need? |
That could be very helpful, or something like a conditional that would only debounce if a value was true, otherwise it would fire immediately. |
Alright in v2.3.0 there is a new option added in called |
Thanks @dhershman1 |
Interestingly, I am seeing the same issue that @skunkworker touched on here. I too have a debounced function within a watcher:
and while the callback is definitely being called, the debounced Thanks 👍 |
It's because debounce returns a debounced function So Or setup your debounces ahead of time
|
Arghhh, of course! Man, how embarrassing! Thanks for that, sorry for wasting your time. Really great package, thanks a lot for your work :) |
Not a waste of time, at first I had commented thinking it was also an issue but then I looked into the function and remembered lol. Thanks for using it! |
Right now I have a text entry box that I want to debounce, but when the text input is blank I want it to be sent instantly.
On my element I have it working just fine if I add
v-debounce:300="sendSearchValue"
, but I feel like I am using the custom debounce function incorrectly. Is there something that I am missing?The text was updated successfully, but these errors were encountered: