-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
Fully refactored throttle
method (object form arguments, pass latest value, supports target)
#31
Conversation
BREAKING CHANGE: unnamed arguments removed, supports only object form closes #25
babel plugin passes sid, loc and name to specific config as argument
Suggestion: const throttled = throttle({ source: unit, timeout: 200 })
// or
const throttled = createEvent()
throttle({
source: unit,
timeout: 200,
target: throttled
}) |
Also, I don't like that throttled unit triggered with first throttled argument const trigger = createEvent()
const throttled = throttle({ source: trigger, timeout: 40 })
trigger(0)
trigger(1)
trigger(2)
For example, see lodash's throttle documentation:
UPD: following next comment, with leading and trailing edges |
Also, it would be cool to have options for leading and trailing edges :) const trigger = createEvent()
const throttled = throttle({ source: trigger, timeout: 40 })
trigger(0)
|
thanks @victordidenko Co-authored-by: Victor Didenko <victord@setplex.com>
BREAKING CHANGE: now payload sent from last source trigger
DeepCode failed to analyze this pull requestSomething went wrong despite trying multiple times, sorry about that. |
throttle
method refactored, now supports only with object formthrottle
method (object form arguments, pass latest value, supports target)
BREAKING CHANGE: unnamed arguments removed, supports only object form, pass payload from the latest
source
triggercloses #25