Skip to content

Use throttle instead of debounce #160

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

Closed
wants to merge 3 commits into from

Conversation

chanzxxx
Copy link
Contributor

@chanzxxx chanzxxx commented Jul 6, 2018

First of all, please understand my bad english.

Version

2.3.1

Vue.js version

2.5.13

What is expected?

When we scroll straight down on the mobile browser, @infinite event should be called immediately after passed the given distance.

What is actually happening?

Since scroll event occurs very frequently and it's faster than debounceDuration in the case above, @infinite is being called after 50ms from scroll stoped. Consequently, @infinite is being called at the bottom of content ignoring given distance.

How to reproduce this problem?

In mobile browser, with a container has overflow-scrolling: touch and scroll down to the bottom very fast.

I think it is more common to use throttle function to limit rate of scroll event handler. So I forked this repo and modified debounce to throttle. It fixed the problem above.

@chanzxxx
Copy link
Contributor Author

chanzxxx commented Jul 6, 2018

I will send a PR again with test.

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.

1 participant