Skip to content

Use IntersectionObserver when it's available #6

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 6 commits into from
Dec 30, 2018

Conversation

Aljullu
Copy link
Owner

@Aljullu Aljullu commented Sep 11, 2018

Fixes #16.

  • Use Intersectionobserver when it's available.
  • Add unit tests.
  • Do some manual testing with real projects.

@Aljullu Aljullu self-assigned this Sep 11, 2018
@Aljullu Aljullu mentioned this pull request Sep 11, 2018
10 tasks

class PlaceholderWithoutTracking extends React.Component {
constructor(props) {
super(props);

if (!window.LAZY_LOAD_OBSERVER) {

Choose a reason for hiding this comment

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

window may be undefined if you're in an SSR context.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Good catch! I think I started this branch before react-lazy-load-image-component added support to SSR, that's why at that time using window to store the observer seemed ok.

I fixed this here: 364ce21.

@Aljullu Aljullu force-pushed the intersection-observer branch 2 times, most recently from ecb4132 to bf50c3f Compare December 30, 2018 16:18
@Aljullu Aljullu force-pushed the intersection-observer branch from bf50c3f to c73bdaa Compare December 30, 2018 17:05
@Aljullu Aljullu force-pushed the intersection-observer branch from 4f8f2b1 to 8d1805c Compare December 30, 2018 17:15
@Aljullu Aljullu changed the title [WIP] Use IntersectionObserver when it's available Use IntersectionObserver when it's available Dec 30, 2018
@Aljullu Aljullu merged commit ccfbd87 into master Dec 30, 2018
@Aljullu Aljullu deleted the intersection-observer branch December 30, 2018 17:25
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