diff options
author | Corey Hulen <corey@hulen.com> | 2015-09-02 12:41:16 -0700 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2015-09-02 12:41:16 -0700 |
commit | 833f6b7df123f25d5aa6bee6aee0c90c82b74c38 (patch) | |
tree | 191b16707373caa2aeecb77d40af64ffe05815db /web/react/components/notify_counts.jsx | |
parent | eaeab0d645ca69efb4a0b47b802db750a6f54136 (diff) | |
parent | aac83dcedc644dfc23fc46366e54c65e0c86c5b9 (diff) | |
download | chat-833f6b7df123f25d5aa6bee6aee0c90c82b74c38.tar.gz chat-833f6b7df123f25d5aa6bee6aee0c90c82b74c38.tar.bz2 chat-833f6b7df123f25d5aa6bee6aee0c90c82b74c38.zip |
Merge pull request #539 from rgarmsen2295/reformat_part_one
MM-2063 Cosmetic Refactoring
Diffstat (limited to 'web/react/components/notify_counts.jsx')
-rw-r--r-- | web/react/components/notify_counts.jsx | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/web/react/components/notify_counts.jsx b/web/react/components/notify_counts.jsx index ebc49882b..0b7c41b62 100644 --- a/web/react/components/notify_counts.jsx +++ b/web/react/components/notify_counts.jsx @@ -23,27 +23,30 @@ function getCountsStateFromStores() { return {count: count}; } -module.exports = React.createClass({ - displayName: 'NotifyCounts', - componentDidMount: function() { +export default class NotifyCounts extends React.Component { + constructor(props) { + super(props); + + this.onListenerChange = this.onListenerChange.bind(this); + + this.state = getCountsStateFromStores(); + } + componentDidMount() { ChannelStore.addChangeListener(this.onListenerChange); - }, - componentWillUnmount: function() { + } + componentWillUnmount() { ChannelStore.removeChangeListener(this.onListenerChange); - }, - onListenerChange: function() { + } + onListenerChange() { var newState = getCountsStateFromStores(); if (!utils.areStatesEqual(newState, this.state)) { this.setState(newState); } - }, - getInitialState: function() { - return getCountsStateFromStores(); - }, - render: function() { + } + render() { if (this.state.count) { return <span className='badge badge-notify'>{this.state.count}</span>; } return null; } -}); +} |