Skip to content

Commit df4ba4b

Browse files
author
Carl Vitullo
committed
Use prettier settings
1 parent 8c8e343 commit df4ba4b

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

src/Container.js

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,84 @@
1-
import React, { PureComponent } from 'react'
2-
import PropTypes from 'prop-types'
3-
import raf from 'raf'
1+
import React, { PureComponent } from "react";
2+
import PropTypes from "prop-types";
3+
import raf from "raf";
44

55
export default class Container extends PureComponent {
66
static childContextTypes = {
77
subscribe: PropTypes.func,
88
unsubscribe: PropTypes.func,
99
getParent: PropTypes.func
10-
}
10+
};
1111

12-
getChildContext () {
12+
getChildContext() {
1313
return {
1414
subscribe: this.subscribe,
1515
unsubscribe: this.unsubscribe,
1616
getParent: this.getParent
17-
}
17+
};
1818
}
1919

2020
events = [
21-
'resize',
22-
'scroll',
23-
'touchstart',
24-
'touchmove',
25-
'touchend',
26-
'pageshow',
27-
'load'
28-
]
21+
"resize",
22+
"scroll",
23+
"touchstart",
24+
"touchmove",
25+
"touchend",
26+
"pageshow",
27+
"load"
28+
];
2929

30-
subscribers = []
30+
subscribers = [];
3131

32-
rafHandle = null
32+
rafHandle = null;
3333

3434
subscribe = handler => {
35-
this.subscribers = this.subscribers.concat(handler)
36-
}
35+
this.subscribers = this.subscribers.concat(handler);
36+
};
3737

3838
unsubscribe = handler => {
39-
this.subscribers = this.subscribers.filter(current => current !== handler)
40-
}
39+
this.subscribers = this.subscribers.filter(current => current !== handler);
40+
};
4141

4242
notifySubscribers = evt => {
4343
if (!this.framePending) {
44-
const { currentTarget } = evt
44+
const { currentTarget } = evt;
4545

4646
this.rafHandle = raf(() => {
47-
this.framePending = false
48-
const { top, bottom } = this.node.getBoundingClientRect()
47+
this.framePending = false;
48+
const { top, bottom } = this.node.getBoundingClientRect();
4949

5050
this.subscribers.forEach(handler =>
5151
handler({
5252
distanceFromTop: top,
5353
distanceFromBottom: bottom,
5454
eventSource: currentTarget === window ? document.body : this.node
5555
})
56-
)
57-
})
58-
this.framePending = true
56+
);
57+
});
58+
this.framePending = true;
5959
}
60-
}
60+
};
6161

62-
getParent = () => this.node
62+
getParent = () => this.node;
6363

64-
componentDidMount () {
64+
componentDidMount() {
6565
this.events.forEach(event =>
6666
window.addEventListener(event, this.notifySubscribers)
67-
)
67+
);
6868
}
6969

70-
componentWillUnmount () {
70+
componentWillUnmount() {
7171
if (this.rafHandle) {
72-
raf.cancel(this.rafHandle)
73-
this.rafHandle = null
72+
raf.cancel(this.rafHandle);
73+
this.rafHandle = null;
7474
}
7575

7676
this.events.forEach(event =>
7777
window.removeEventListener(event, this.notifySubscribers)
78-
)
78+
);
7979
}
8080

81-
render () {
81+
render() {
8282
return (
8383
<div
8484
{...this.props}
@@ -88,6 +88,6 @@ export default class Container extends PureComponent {
8888
onTouchMove={this.notifySubscribers}
8989
onTouchEnd={this.notifySubscribers}
9090
/>
91-
)
91+
);
9292
}
9393
}

0 commit comments

Comments
 (0)