mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-09-21 07:52:58 +00:00
Add reload when initStream message is received
This commit is contained in:
@@ -66,6 +66,18 @@ const Homebrew = createClass({
|
||||
return {};
|
||||
},
|
||||
|
||||
componentDidMount : function(){
|
||||
const eventSource = new EventSource('/stream');
|
||||
|
||||
eventSource.addEventListener('message', (evt)=>{
|
||||
const messageData = JSON.parse(evt.data);
|
||||
|
||||
if(messageData.eventType == 'initStream'){
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
render : function (){
|
||||
return (
|
||||
<Router location={this.props.url}>
|
||||
|
||||
Reference in New Issue
Block a user