diff options
author | nickago <ngonella@calpoly.edu> | 2015-07-06 12:37:42 -0700 |
---|---|---|
committer | nickago <ngonella@calpoly.edu> | 2015-07-06 12:37:42 -0700 |
commit | 83e4d3fb9cd2692a0363f48e70a50989b3e9a163 (patch) | |
tree | 6b00dde1f44ad57518deca39b55ff20d5eb0f657 /web/react/components | |
parent | 8ac5f2233750c621099abb51006bf6fb0adbbf74 (diff) | |
download | chat-83e4d3fb9cd2692a0363f48e70a50989b3e9a163.tar.gz chat-83e4d3fb9cd2692a0363f48e70a50989b3e9a163.tar.bz2 chat-83e4d3fb9cd2692a0363f48e70a50989b3e9a163.zip |
Changed socket event to a props based change
Diffstat (limited to 'web/react/components')
-rw-r--r-- | web/react/components/msg_typing.jsx | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/web/react/components/msg_typing.jsx b/web/react/components/msg_typing.jsx index 089412229..a6953028f 100644 --- a/web/react/components/msg_typing.jsx +++ b/web/react/components/msg_typing.jsx @@ -1,7 +1,7 @@ // Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. // See License.txt for license information. -var ChannelStore = require('../stores/channel_store.jsx'); + var SocketStore = require('../stores/socket_store.jsx'); var UserStore = require('../stores/user_store.jsx'); @@ -9,17 +9,17 @@ module.exports = React.createClass({ timer: null, lastTime: 0, componentDidMount: function() { - ChannelStore.addDiffChannelChangeListener(this._onChange); - SocketStore.addChangeListener(this._onSocketChange); + SocketStore.addChangeListener(this._onChange); }, - componentWillUnmount: function() { - ChannelStore.removeDiffChannelChangeListener(this._onChange); - SocketStore.removeChangeListener(this._onSocketChange); + componentWillReceiveProps: function(newProps) { + if(this.props.channelId !== newProps.channelId) { + this.setState({text:""}); + } }, - _onChange: function() { - this.setState({text:""}) + componentWillUnmount: function() { + SocketStore.removeChangeListener(this._onChange); }, - _onSocketChange: function(msg) { + _onChange: function(msg) { if (msg.action == "typing" && this.props.channelId == msg.channel_id && this.props.parentId == msg.props.parent_id) { |