Skip to content
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

Add the ability to use a closure as a "debounce" and "throttle" value in the onEvent decorator #4

Open
andyduke opened this issue Feb 6, 2024 · 0 comments
Assignees

Comments

@andyduke
Copy link
Owner

andyduke commented Feb 6, 2024

Replace debounce and throttle handling in EventsController.createHandler:

if (event.debounce) {
-  handler = debounce(handler, event.debounce);
+  handler = debounce(handler, (typeof event.debounce) == 'function' ? event.debounce.call(this.host, this.host) : event.debounce);
}
} else if (event.throttle) {
-  handler = throttle(handler, event.throttle);
+  handler = throttle(handler, (typeof event.throttle) == 'function' ? event.throttle.call(this.host, this.host) : event.throttle);
}
@andyduke andyduke self-assigned this Feb 6, 2024
@andyduke andyduke changed the title Add the ability to use a closure as a "debounce" and "throttle" value in the onEvent decorator. Add the ability to use a closure as a "debounce" and "throttle" value in the onEvent decorator Feb 6, 2024
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

No branches or pull requests

1 participant