Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
docs(example): fix the comma situation in transfer-files
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Mar 17, 2017
1 parent ac106e7 commit cc0abcd
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions examples/transfer-files/public/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ function onDrop (event) {
*/

// Get peers from IPFS and display them
let numberOfPeersLastTime = 0

function connectToPeer (event) {
event.target.disabled = true
Expand All @@ -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 '<li>' + p + '</li>'
}).join()

$peers.innerHTML = res.length > 0
? '<h2>Remote Peers</h2><ul>' + peersAsHtml + '</ul>'
: '<h2>Remote Peers</h2><i>Waiting for peers...</i>'
}
numberOfPeersLastTime = res.length

const peersAsHtml = peers
.map((peer) => peer.addr.toString())
.map((addr) => {
return '<li>' + addr + '</li>'
}).join('')

$peers.innerHTML = peers.length > 0
? '<h2>Remote Peers</h2><ul>' + peersAsHtml + '</ul>'
: '<h2>Remote Peers</h2><i>Waiting for peers...</i>'
})
}

Expand Down

0 comments on commit cc0abcd

Please sign in to comment.