From cc0abcd2749926b28844e41e4a0076e9bec4d169 Mon Sep 17 00:00:00 2001 From: David Dias Date: Fri, 17 Mar 2017 18:35:09 +0000 Subject: [PATCH] docs(example): fix the comma situation in transfer-files --- examples/transfer-files/public/js/app.js | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/examples/transfer-files/public/js/app.js b/examples/transfer-files/public/js/app.js index d3618d549f..636d5cde91 100644 --- a/examples/transfer-files/public/js/app.js +++ b/examples/transfer-files/public/js/app.js @@ -158,7 +158,6 @@ function onDrop (event) { */ // Get peers from IPFS and display them -let numberOfPeersLastTime = 0 function connectToPeer (event) { event.target.disabled = true @@ -176,21 +175,20 @@ function connectToPeer (event) { } function refreshPeerList () { - node.swarm.peers((err, res) => { + node.swarm.peers((err, peers) => { if (err) { return onError(err) } - if (numberOfPeersLastTime !== res.length) { - const peersAsHtml = res.map((p) => p.addr.toString()) - .map((p) => { - return '
  • ' + p + '
  • ' - }).join() - - $peers.innerHTML = res.length > 0 - ? '

    Remote Peers

    ' - : '

    Remote Peers

    Waiting for peers...' - } - numberOfPeersLastTime = res.length + + const peersAsHtml = peers + .map((peer) => peer.addr.toString()) + .map((addr) => { + return '
  • ' + addr + '
  • ' + }).join('') + + $peers.innerHTML = peers.length > 0 + ? '

    Remote Peers

    ' + : '

    Remote Peers

    Waiting for peers...' }) }