mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-03-28 05:11:04 +00:00
feat: use class-is for type checks
This commit is contained in:
parent
141920cd14
commit
bb0c9905ed
@ -10,6 +10,7 @@ const series = require('async/series')
|
|||||||
const PeerBook = require('peer-book')
|
const PeerBook = require('peer-book')
|
||||||
const Switch = require('libp2p-switch')
|
const Switch = require('libp2p-switch')
|
||||||
const Ping = require('libp2p-ping')
|
const Ping = require('libp2p-ping')
|
||||||
|
const WebSockets = require('libp2p-websockets')
|
||||||
|
|
||||||
const peerRouting = require('./peer-routing')
|
const peerRouting = require('./peer-routing')
|
||||||
const contentRouting = require('./content-routing')
|
const contentRouting = require('./content-routing')
|
||||||
@ -129,8 +130,7 @@ class Node extends EventEmitter {
|
|||||||
if (transport.filter(multiaddrs).length > 0) {
|
if (transport.filter(multiaddrs).length > 0) {
|
||||||
this.switch.transport.add(
|
this.switch.transport.add(
|
||||||
transport.tag || transport.constructor.name, transport)
|
transport.tag || transport.constructor.name, transport)
|
||||||
} else if (transport.constructor &&
|
} else if (WebSockets.isWebSockets(transport)) {
|
||||||
transport.constructor.name === 'WebSockets') {
|
|
||||||
// TODO find a cleaner way to signal that a transport is always
|
// TODO find a cleaner way to signal that a transport is always
|
||||||
// used for dialing, even if no listener
|
// used for dialing, even if no listener
|
||||||
ws = transport
|
ws = transport
|
||||||
|
Loading…
x
Reference in New Issue
Block a user