hypercore 10.37.15 → 10.37.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +8 -0
- package/lib/replicator.js +0 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -270,6 +270,14 @@ module.exports = class Hypercore extends EventEmitter {
|
|
|
270
270
|
this.writable = this._isWritable()
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
+
setActive (bool) {
|
|
274
|
+
const active = !!bool
|
|
275
|
+
if (active === this._active) return
|
|
276
|
+
this._active = active
|
|
277
|
+
if (!this.opened || this.closing) return
|
|
278
|
+
this.replicator.updateActivity(this._active ? 1 : -1)
|
|
279
|
+
}
|
|
280
|
+
|
|
273
281
|
_passCapabilities (o) {
|
|
274
282
|
if (!this.keyPair) this.keyPair = o.keyPair
|
|
275
283
|
this.crypto = o.crypto
|
package/lib/replicator.js
CHANGED