Skip to content

New debounce edge types #46

@Sv443

Description

@Sv443

The current rising edge (immediate in the below diagram) will potentially lose the last few debounced listener calls, for a duration up to the set debounce time.
This is contrary to the current falling impl. (queuedIdle in the below diagram), which will ensure the very last time the debounced function is called, that call will be passed along to the listener to ensure the last call contains the newest data. But it may never be called if the events are too frequent.

To fix both these problems, a third edge type (queuedImmediate) should be introduced.
In the end it could look something like this:

Click to view diagram

debounce_v2

Edit:

Disregard the things above, I changed the implementation again to simplify it and still cover just about any use case. Refer to the docs for the up to date info.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions