-
Notifications
You must be signed in to change notification settings - Fork 195
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
Changed default behaviour from intervalCheck to onScroll Listener. #54
Conversation
Update: delay props now referrer to the debounce time of when scrolling is triggered Update: IntervalCheck still exists but needs to be enabled with a boolean intervalCheck prop, and also intervalDelay (which was the old delay) can be adjusted. Update: Updated tests to the new version and added scrolling test.
Update: Readme to add the rest of the allowed props.
Also changed Travis to run the tests with Chrome, so we have consistency between development machines and Travis. |
hm, im wondering if |
@Andarist, I initially implemented throttle but my problem was that usually the visibility state matters when you reach the end of scrolling, so throttle, with a delay of 250ms means that it triggers once the user starts scrolling and again every 250ms if the scrolling persists. I got weird results in my usage with Visibility Sensor when I plugged in throttle. I think it's better to trigger at the end than at the start, a best implementation I think would be a combination of both. |
@eek sorry it's taken me a while to get to reviewing this. I've had some time to sit down and look over this closely today, and really like what I see - thanks! Some notes:
|
We might also consider adding an option to switch between |
@eek here's my proposal for a few changes to your PR. If you're happy with them I'll go ahead and merge, but let me know if you want to discuss anything: eek/react-visibility-sensor@master...joshwnj:pr-54-proposal Summary of changes:
|
Looks good! :D I'm ok with the changes :D Although I don't know how listening to scroll on a container behaves, I'm always attaching the scroll event to window / document :D But since the tests passed, that's awesome. :D |
What would you say about implementing https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API |
Thanks for this pr @eek ! Published v3.6.0 to npm. Cool to see how much more responsive the contained element is in the example too: http://joshwnj.github.io/react-visibility-sensor/ |
Fixes #10 and #36
Update: Changed main behaviour from intervalCheck to onScroll Listener
Update: Delay props now referrer to the scrolling debounce time until check is called
Update: IntervalCheck still exists but needs to be enabled with a bool
intervalCheck
prop, and addedintervalDelay
prop (which was the olddelay
) that can adjust the interval check.Update: Updated tests to the new version and added test for user scrolling.
Update: intervalCheck is automatically enabled when
scrollCheck
props is set tofalse
Update: Readme to add the new props + descriptions