Skip to content

Conversation

@glasser
Copy link

@glasser glasser commented Nov 15, 2025

The current behavior of leading: true, trailing: true is surprising to some people. When leading is false, the semantics are that there will always be some call to the debounced function within the debounce interval of a call to it. But turning on leading changes that.

In case the current behavior is desirable to some users, this change leaves current behavior alone and adds a new trailing: 'always' option value.

Fixes #43.

The current behavior of `leading: true, trailing: true` is surprising to
some people. When `leading` is false, the semantics are that there will
always be *some* call to the debounced function within the debounce
interval of a call to it. But turning on `leading` changes that.

In case the current behavior is desirable to some users, this change
leaves current behavior alone and adds a new `trailing: 'always'` option
value.

Fixes unjs#43.
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

Successfully merging this pull request may close these issues.

No trailing call when leading is true even if trailing is also true

1 participant