Skip to content

feat: add scroll debounce #383

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

Merged
merged 2 commits into from
Apr 4, 2025
Merged

Conversation

clevali
Copy link
Contributor

@clevali clevali commented Apr 3, 2025

hi , i add debounce type , i'm not sure it is suitable , review it , please

i will follow this after that to update version or build
image

@clevali clevali mentioned this pull request Apr 3, 2025
@clevali clevali force-pushed the feat/add-debounce branch 3 times, most recently from e26e10b to 0c78e99 Compare April 3, 2025 15:17
@clevali clevali force-pushed the feat/add-debounce branch from 0c78e99 to 556fab0 Compare April 3, 2025 15:19
// Options are: "debounce" or "throttle"
// If not set,use debounce less than 333ms , other use throttle.
// for ios browser can't use history.pushState() more than 100 times per 30 seconds reason
scrollHandlerType: undefined,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like maybe we should just make the default here debounce since it should be better than throttle and setting that as the default here will make it more obvious whats being used and the ux between the two should be similar enough that I don't think it would be a breaking change. That way it also doesn't take extra config for users to avoid this problem on ios which I feel could be fairly common. What do you think?

Copy link
Contributor Author

@clevali clevali Apr 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

actually,current is like debounce default,maybe use undefined is not clear enough,maybe better to use 'auto',
i think the default type should auto change by timeout,i think it is slow if timeout greater than 334ms+ when use debounce
how about this?

c456cc2

image

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that’s what I thought, having as denounce would be a bit clearer. But it seemed like it was checking for the exact string of “debounce”. Anyway, I like the idea of auto too if you think that would be better, I think as long as there is a comment explaining the threshold it should be good. Thanks!

@clevali clevali force-pushed the feat/add-debounce branch from a7e79e9 to c456cc2 Compare April 4, 2025 03:05
@tscanlin tscanlin merged commit 2ebff3e into tscanlin:master Apr 4, 2025
4 checks passed
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.

2 participants