Skip to content

Conversation

jesuisYves
Copy link

In the current implementation of throttle, the function to be throttled is always called with the arguments it was first called with.

When calling throttled after the timer has expired, it calls wrapped with the previous arguments, but wrapped calls throttled again with those arguments, and so there is a mutual recursion.

To prevent this we need to store the arguments for the deferred call in the outer context of throttle and wrapped.

I also changed the usage example to show that the problem was solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant