Skip to content

Commit cd6dbf8

Browse files
committed
rename ParallaxScrollListener to ParallaxController for clarity; use a static method to initialize new instances; update Parallax components to reference new global name; update example client init functions
1 parent 06126da commit cd6dbf8

File tree

6 files changed

+373
-376
lines changed

6 files changed

+373
-376
lines changed

examples/parallax-example/client.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
33
import { ParallaxExample } from 'components';
4-
import { ParallaxScroller } from 'react-scroll-parallax';
4+
import { ParallaxController } from 'react-scroll-parallax';
55

6-
ParallaxScroller.init();
6+
ParallaxController.init();
77

88
const root = document.getElementById('root');
99

examples/parallax-test/client.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
33
import { ParallaxTest } from 'components';
4-
import { ParallaxScroller } from 'react-scroll-parallax';
4+
import { ParallaxController } from 'react-scroll-parallax';
55

6-
ParallaxScroller.init();
6+
ParallaxController.init();
77

88
const root = document.getElementById('root');
99

src/components/Parallax.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ export default class Parallax extends Component {
2828

2929
componentDidMount() {
3030
// add this Parallax element to the global listener
31-
if (typeof ParallaxScrollListener === 'undefined') {
32-
throw new Error('Must initialize the ParallaxScroller before adding React Parallax components.');
31+
if (typeof ParallaxController === 'undefined') {
32+
throw new Error('Must initialize the ParallaxController before adding React Parallax components.');
3333
}
3434
// create a new parallax element and save the reference
35-
this.element = ParallaxScrollListener.createElement({
35+
this.element = ParallaxController.createElement({
3636
elInner: this._inner,
3737
elOuter: this._outer,
3838
props: this.props,
@@ -42,16 +42,16 @@ export default class Parallax extends Component {
4242
componentWillReceiveProps(nextProps) {
4343
// updates the elements props when changed
4444
if (this.props !== nextProps) {
45-
ParallaxScrollListener.updateElement(this.element, { props: nextProps });
45+
ParallaxController.updateElement(this.element, { props: nextProps });
4646
}
4747
// resets element styles when disabled
4848
if (this.props.disabled !== nextProps.disabled && nextProps.disabled) {
49-
ParallaxScrollListener.resetElementStyles(this.element);
49+
ParallaxController.resetElementStyles(this.element);
5050
}
5151
}
5252

5353
componentWillUnmount() {
54-
ParallaxScrollListener.removeElement(this.element);
54+
ParallaxController.removeElement(this.element);
5555
}
5656

5757
// refs

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export Parallax from './components/Parallax';
2-
export ParallaxScroller from './libs/ParallaxScroller';
2+
export ParallaxController from './libs/ParallaxController';

0 commit comments

Comments
 (0)