corestore 6.4.1 → 6.4.2

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.
Files changed (2) hide show
  1. package/index.js +7 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -60,6 +60,11 @@ module.exports = class Corestore extends EventEmitter {
60
60
  }
61
61
  }
62
62
 
63
+ _emitCore (name, core) {
64
+ this.emit(name, core)
65
+ if (this !== this._root) this._root.emit(name, core)
66
+ }
67
+
63
68
  _incFindingPeers () {
64
69
  if (++this._findingPeersCount !== 1) return
65
70
 
@@ -201,7 +206,7 @@ module.exports = class Corestore extends EventEmitter {
201
206
  this.cores.set(id, core)
202
207
  core.ready().then(() => {
203
208
  if (core.closing) return // extra safety here as ready is a tick after open
204
- this.emit('core-open', core)
209
+ this._emitCore('core-open', core)
205
210
  for (const { stream } of this._replicationStreams) {
206
211
  core.replicate(stream, { session: true })
207
212
  }
@@ -209,7 +214,7 @@ module.exports = class Corestore extends EventEmitter {
209
214
  this.cores.delete(id)
210
215
  })
211
216
  core.once('close', () => {
212
- this.emit('core-close', core)
217
+ this._emitCore('core-close', core)
213
218
  this.cores.delete(id)
214
219
  })
215
220
  core.on('conflict', (len, fork, proof) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "corestore",
3
- "version": "6.4.1",
3
+ "version": "6.4.2",
4
4
  "description": "A Hypercore factory that simplifies managing collections of cores.",
5
5
  "main": "index.js",
6
6
  "scripts": {