feat(app): p2p peers indicator
This commit is contained in:
parent
f23d45996b
commit
e5b9e4793a
@ -82,10 +82,18 @@ window.isReady = () => {
|
|||||||
return (appReady && loadersCount === 0)
|
return (appReady && loadersCount === 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.peers = 0;
|
||||||
|
|
||||||
class App extends Component {
|
class App extends Component {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
window.router()
|
window.router()
|
||||||
appReady = true;
|
appReady = true;
|
||||||
|
|
||||||
|
window.torrentSocket.on('peer', (numOfPeers) => {
|
||||||
|
window.peers = numOfPeers
|
||||||
|
console.log(window.peers)
|
||||||
|
this.forceUpdate()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
appReady = false;
|
appReady = false;
|
||||||
@ -94,6 +102,9 @@ class App extends Component {
|
|||||||
return (
|
return (
|
||||||
<MuiThemeProvider>
|
<MuiThemeProvider>
|
||||||
<PagesPie />
|
<PagesPie />
|
||||||
|
<div className='fs0-85 pad0-75' style={{position: 'fixed', bottom: 0, left: 0, color: window.peers > 0 ? 'green' : 'grey'}}>
|
||||||
|
rats peers: {window.peers} {window.peers > 0 ? ' (p2p rats search enabled)' : ' (p2p rats search not available at this moment)'}
|
||||||
|
</div>
|
||||||
</MuiThemeProvider>
|
</MuiThemeProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user