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
When using throttle from lodash, if one or more calls are made during the wait period, a single call will be scheduled at the end of the wait period (i.e. the trailing edge). For example:
const throttled = throttle(() => console.log("called"), 5000)
for (var i=0; i < 3; i++) throttled()
You should see the throttled function called twice. However, with pydash, I'm only seeing a single call. If using to check for updates to a resource, you might miss the last update as a result. Here's the equivalent pydash example that I tried:
throttled = throttle(lambda: print("called"), 5000)
[throttled() for _ in range(3)]
Just taking a quick look at the source, pydash's debounce is lacking lodash's leading / trailing options. If those were present and implemented, throttle could just be rewritten as a call to debounce (which is how lodash's throttle is done).
The text was updated successfully, but these errors were encountered:
When using throttle from lodash, if one or more calls are made during the wait period, a single call will be scheduled at the end of the wait period (i.e. the trailing edge). For example:
You should see the throttled function called twice. However, with pydash, I'm only seeing a single call. If using to check for updates to a resource, you might miss the last update as a result. Here's the equivalent pydash example that I tried:
Just taking a quick look at the source, pydash's debounce is lacking lodash's leading / trailing options. If those were present and implemented, throttle could just be rewritten as a call to debounce (which is how lodash's throttle is done).
The text was updated successfully, but these errors were encountered: