mirror of https://github.com/vector-im/riot-web
messages arrive!
parent
0b0e6adce3
commit
4bb570c545
|
@ -11,12 +11,27 @@ module.exports = React.createClass({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
componentWillMount: function() {
|
||||||
|
MatrixClientPeg.get().on("Room.timeline", this.onRoomTimeline);
|
||||||
|
},
|
||||||
|
|
||||||
|
componentWillUnmount: function() {
|
||||||
|
MatrixClientPeg.get().removeListener("Room.timeline", this.onRoomTimeline);
|
||||||
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(props) {
|
componentWillReceiveProps: function(props) {
|
||||||
this.setState({
|
this.setState({
|
||||||
room: MatrixClientPeg.get().getRoom(props.room_id)
|
room: MatrixClientPeg.get().getRoom(props.room_id)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onRoomTimeline: function(ev, room, toStartOfTimeline) {
|
||||||
|
if (room.roomId != this.props.room_id) return;
|
||||||
|
this.setState({
|
||||||
|
room: MatrixClientPeg.get().getRoom(this.props.room_id)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
getMessageTiles: function() {
|
getMessageTiles: function() {
|
||||||
return this.state.room.timeline.map(function(mxEv) {
|
return this.state.room.timeline.map(function(mxEv) {
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in New Issue