mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 01:25:17 +01:00
Move onChange() to after componentWillUnmount() for ESLint
This commit is contained in:
parent
543605aae3
commit
2711c4ddb9
@ -25,18 +25,6 @@ let EditionContainer = React.createClass({
|
|||||||
return EditionStore.getState();
|
return EditionStore.getState();
|
||||||
},
|
},
|
||||||
|
|
||||||
onChange(state) {
|
|
||||||
this.setState(state);
|
|
||||||
if (!state.edition.digital_work) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let isEncoding = state.edition.digital_work.isEncoding;
|
|
||||||
if (state.edition.digital_work.mime === 'video' && typeof isEncoding === 'number' && isEncoding !== 100 && !this.state.timerId) {
|
|
||||||
let timerId = window.setInterval(() => EditionActions.fetchOne(this.props.params.editionId), 10000);
|
|
||||||
this.setState({timerId: timerId});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
EditionStore.listen(this.onChange);
|
EditionStore.listen(this.onChange);
|
||||||
|
|
||||||
@ -62,6 +50,17 @@ let EditionContainer = React.createClass({
|
|||||||
EditionStore.unlisten(this.onChange);
|
EditionStore.unlisten(this.onChange);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onChange(state) {
|
||||||
|
this.setState(state);
|
||||||
|
if (!state.edition.digital_work) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let isEncoding = state.edition.digital_work.isEncoding;
|
||||||
|
if (state.edition.digital_work.mime === 'video' && typeof isEncoding === 'number' && isEncoding !== 100 && !this.state.timerId) {
|
||||||
|
let timerId = window.setInterval(() => EditionActions.fetchOne(this.props.params.editionId), 10000);
|
||||||
|
this.setState({timerId: timerId});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
loadEdition() {
|
loadEdition() {
|
||||||
EditionActions.fetchOne(this.props.params.editionId);
|
EditionActions.fetchOne(this.props.params.editionId);
|
||||||
|
Loading…
Reference in New Issue
Block a user