Last active
October 27, 2017 03:18
-
-
Save dbani-dev/3c7acf205c97cc9d9773408941b46f26 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ToolbarStatus extends Component { | |
constructor(props) { | |
super(props); | |
} | |
componentWillReceiveProps(nextProps) { | |
if (!nextProps.isFetching && !nextProps.isFailure) { | |
this.timer = setInterval(this.tick, 30000); | |
} | |
} | |
componentWillUnmount() { | |
clearInterval(this.timer); | |
} | |
tick = () => { | |
this.props.timestampUpdate(); // Doesnt pass action arguments '#0001' | |
} | |
render() { | |
return ( | |
) | |
} | |
} | |
class Events extends Component { | |
constructor(props) { | |
super(props) | |
} | |
render() { | |
<ToolbarStatus timestampUpdate={() => this.props.eventsTimestampUpdate('#0001')} /> | |
); | |
} | |
} | |
const mapDispatchToProps = (dispatch) => { | |
return | |
eventsTimestampUpdate: (pointId) => dispatch(eventsTimestampUpdate(pointId)), | |
} | |
} | |
export default connect(mapStateToProps, mapDispatchToProps)(Events); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment