You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hardcoding this to always use the global setTimeout is problematic. In most unit testing frameworks, there's no way to programmatically skip forward to the execution time - we'd have to also setTimeout in the tests.
Proposal: allow debounce method to take in an object containing the settings, as it's starting to accept quite a few. What if we want to specify wait and setTimeout but not immediate?
The text was updated successfully, but these errors were encountered:
I'm going to pass on this. Timer mocking is the defacto way to handle this. You generally don't use debounce directly in your tests, so you would then have to pass these through from your own functions too. And every package you use that use a timer internally would have to support passing in the timer globals for this to work.
Hardcoding this to always use the global
setTimeout
is problematic. In most unit testing frameworks, there's no way to programmatically skip forward to the execution time - we'd have to alsosetTimeout
in the tests.Proposal: allow
debounce
method to take in an object containing the settings, as it's starting to accept quite a few. What if we want to specifywait
andsetTimeout
but notimmediate
?The text was updated successfully, but these errors were encountered: