-
Notifications
You must be signed in to change notification settings - Fork 2
Debouncing #47
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
base: main
Are you sure you want to change the base?
Debouncing #47
Conversation
thibaultzanini
commented
Apr 15, 2025
- Add debounced interaction management to Target
- Add debouncing functionality to Button component
| } | ||
| } | ||
|
|
||
| _updateActionDebounceRegistration() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marchant if you come up with a better name
| * @type {Map<string, number>} | ||
| * @private | ||
| */ | ||
| __debouncedInteractionThresholds: { value: null }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marchant if you come up with a better name
| this._debouncedInteractionTimestamps.delete(interactionKey); | ||
| } | ||
|
|
||
| shouldPreventInteraction(interactionKey) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marchant if you come up with a better name
| this.active = false; | ||
| this.dispatchActionEvent(); | ||
|
|
||
| if (!this.shouldPreventInteraction("action")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marchant I tried to add it to the press composer and the key composers and it worked fine only when the source was the same composer.
Meaning, an interaction from the press composer and the key composer during the debouncing window will cause 2 action events. So, I added the logic to Target and it's managed by the button itself. I also have a version working for the press composer and the key composer but that would be for another PR.