@@ -7,15 +7,15 @@ class PlaceholderWithoutTracking extends React.Component {
7
7
constructor ( props ) {
8
8
super ( props ) ;
9
9
10
- if ( ! window . LAZY_LOAD_OBSERVER ) {
10
+ if ( ! this . LAZY_LOAD_OBSERVER ) {
11
11
const supportsObserver = isIntersectionObserverAvailable ( ) ;
12
12
13
- window . LAZY_LOAD_OBSERVER = { supportsObserver } ;
13
+ this . LAZY_LOAD_OBSERVER = { supportsObserver } ;
14
14
15
15
if ( supportsObserver ) {
16
16
const { threshold } = props ;
17
17
18
- window . LAZY_LOAD_OBSERVER . observer = new IntersectionObserver (
18
+ this . LAZY_LOAD_OBSERVER . observer = new IntersectionObserver (
19
19
this . checkIntersections , { rootMargin : threshold + 'px' } ) ;
20
20
}
21
21
}
@@ -31,26 +31,26 @@ class PlaceholderWithoutTracking extends React.Component {
31
31
32
32
componentDidMount ( ) {
33
33
if ( this . placeholder &&
34
- window . LAZY_LOAD_OBSERVER && window . LAZY_LOAD_OBSERVER . observer ) {
34
+ this . LAZY_LOAD_OBSERVER && this . LAZY_LOAD_OBSERVER . observer ) {
35
35
this . placeholder . onVisible = this . props . onVisible ;
36
- window . LAZY_LOAD_OBSERVER . observer . observe ( this . placeholder ) ;
36
+ this . LAZY_LOAD_OBSERVER . observer . observe ( this . placeholder ) ;
37
37
}
38
38
39
- if ( window . LAZY_LOAD_OBSERVER &&
40
- ! window . LAZY_LOAD_OBSERVER . supportsObserver ) {
39
+ if ( this . LAZY_LOAD_OBSERVER &&
40
+ ! this . LAZY_LOAD_OBSERVER . supportsObserver ) {
41
41
this . updateVisibility ( ) ;
42
42
}
43
43
}
44
44
45
45
componentWillUnMount ( ) {
46
- if ( window . LAZY_LOAD_OBSERVER ) {
47
- window . LAZY_LOAD_OBSERVER . observer . unobserve ( this . placeholder ) ;
46
+ if ( this . LAZY_LOAD_OBSERVER ) {
47
+ this . LAZY_LOAD_OBSERVER . observer . unobserve ( this . placeholder ) ;
48
48
}
49
49
}
50
50
51
51
componentDidUpdate ( ) {
52
- if ( window . LAZY_LOAD_OBSERVER &&
53
- ! window . LAZY_LOAD_OBSERVER . supportsObserver ) {
52
+ if ( this . LAZY_LOAD_OBSERVER &&
53
+ ! this . LAZY_LOAD_OBSERVER . supportsObserver ) {
54
54
this . updateVisibility ( ) ;
55
55
}
56
56
}
0 commit comments