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

Commit 74c305d

Browse files
generalpistonvasco-santos
authored andcommitted
fix: use callback in start from js-libp2p (#93)
1 parent 8f90e44 commit 74c305d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict'
22

3+
const nextTick = require('async/nextTick')
34
const PeerId = require('peer-id')
45
const PeerInfo = require('peer-info')
56
const multiaddr = require('multiaddr')
@@ -31,15 +32,19 @@ class Bootstrap extends EventEmitter {
3132

3233
/**
3334
* Start emitting events.
35+
*
36+
* @param {Function} cb - callback indicating completion
3437
*/
35-
start () {
38+
start (cb) {
3639
if (this._timer) {
3740
return
3841
}
3942

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

4245
this._discoverBootstrapPeers()
46+
47+
cb && nextTick(() => cb())
4348
}
4449

4550
/**

0 commit comments

Comments
 (0)