mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-04-25 02:22:14 +00:00
fix: dont override methods of created instance (#394)
* fix: dont override methods of created instance * chore: fix lint
This commit is contained in:
parent
f4f3f0f03a
commit
3e95e6f9e4
12
src/index.js
12
src/index.js
@ -187,13 +187,6 @@ class Libp2p extends EventEmitter {
|
||||
})
|
||||
|
||||
this._peerDiscovered = this._peerDiscovered.bind(this)
|
||||
|
||||
// promisify all instance methods
|
||||
;['start', 'stop', 'dial', 'dialProtocol', 'dialFSM', 'hangUp', 'ping'].forEach(method => {
|
||||
this[method] = promisify(this[method], {
|
||||
context: this
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@ -557,6 +550,11 @@ class Libp2p extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
// promisify all instance methods
|
||||
['start', 'stop', 'dial', 'dialProtocol', 'dialFSM', 'hangUp', 'ping'].forEach(method => {
|
||||
Libp2p[method] = promisify(Libp2p[method])
|
||||
})
|
||||
|
||||
module.exports = Libp2p
|
||||
/**
|
||||
* Like `new Libp2p(options)` except it will create a `PeerInfo`
|
||||
|
Loading…
x
Reference in New Issue
Block a user