Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

#92: use callback in start from js-libp2p #93

Merged
merged 3 commits into from
Jul 31, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

const nextTick = require('async/nextTick')
const PeerId = require('peer-id')
const PeerInfo = require('peer-info')
const multiaddr = require('multiaddr')
Expand Down Expand Up @@ -31,15 +32,19 @@ class Bootstrap extends EventEmitter {

/**
* Start emitting events.
*
* @param {Function} cb - callback indicating completion
*/
start () {
start (cb) {
if (this._timer) {
return
}

this._timer = setInterval(() => this._discoverBootstrapPeers(), this._interval)

this._discoverBootstrapPeers()

cb && nextTick(() => cb())
}

/**
Expand Down