Simplify code

This commit is contained in:
Franck Royer 2021-07-07 14:04:28 +10:00
parent 34e6ac5247
commit acdc032253
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
2 changed files with 2 additions and 6 deletions

View File

@ -76,7 +76,7 @@ export class Waku {
this.lightPush = lightPush; this.lightPush = lightPush;
this.keepAliveTimers = {}; this.keepAliveTimers = {};
const keepAlive = options.keepAlive !== undefined ? options.keepAlive : 0; const keepAlive = options.keepAlive || 0;
if (keepAlive !== 0) { if (keepAlive !== 0) {
libp2p.connectionManager.on('peer:connect', (connection: Connection) => { libp2p.connectionManager.on('peer:connect', (connection: Connection) => {

View File

@ -87,11 +87,7 @@ export class WakuRelay extends Gossipsub {
Object.assign(this, { multicodecs }); Object.assign(this, { multicodecs });
if (options?.pubsubTopic) { this.pubsubTopic = options?.pubsubTopic || constants.DefaultPubsubTopic;
this.pubsubTopic = options.pubsubTopic;
} else {
this.pubsubTopic = constants.DefaultPubsubTopic;
}
} }
/** /**