From e5b9e4793a4a0de588c94fa3effa2adc4ed14032 Mon Sep 17 00:00:00 2001 From: Alexey Kasyanchuk Date: Sat, 17 Feb 2018 20:36:26 +0300 Subject: [PATCH] feat(app): p2p peers indicator --- src/app/app.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/app/app.js b/src/app/app.js index 70b4442..bf213e1 100644 --- a/src/app/app.js +++ b/src/app/app.js @@ -82,10 +82,18 @@ window.isReady = () => { return (appReady && loadersCount === 0) } +window.peers = 0; + class App extends Component { componentDidMount() { window.router() appReady = true; + + window.torrentSocket.on('peer', (numOfPeers) => { + window.peers = numOfPeers + console.log(window.peers) + this.forceUpdate() + }) } componentWillUnmount() { appReady = false; @@ -94,6 +102,9 @@ class App extends Component { return ( +
0 ? 'green' : 'grey'}}> + rats peers: {window.peers} {window.peers > 0 ? ' (p2p rats search enabled)' : ' (p2p rats search not available at this moment)'} +
); }