corestore 6.2.1 → 6.4.0
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/README.md +8 -0
- package/index.js +5 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -79,6 +79,14 @@ Useful when an application wants to accept an optional Corestore, but needs to m
|
|
|
79
79
|
}
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
+
#### `store.on('core-open', core)`
|
|
83
|
+
Emitted when the first session for a core is opened.
|
|
84
|
+
|
|
85
|
+
*Note: This core may close at any time, so treat it as a weak reference*
|
|
86
|
+
|
|
87
|
+
#### `store.on('core-close', core)`
|
|
88
|
+
Emitted when the last session for a core is closed.
|
|
89
|
+
|
|
82
90
|
### License
|
|
83
91
|
MIT
|
|
84
92
|
|
package/index.js
CHANGED
|
@@ -201,6 +201,7 @@ module.exports = class Corestore extends EventEmitter {
|
|
|
201
201
|
this.cores.set(id, core)
|
|
202
202
|
core.ready().then(() => {
|
|
203
203
|
if (core.closing) return // extra safety here as ready is a tick after open
|
|
204
|
+
this.emit('core-open', core)
|
|
204
205
|
for (const { stream } of this._replicationStreams) {
|
|
205
206
|
core.replicate(stream, { session: true })
|
|
206
207
|
}
|
|
@@ -208,8 +209,12 @@ module.exports = class Corestore extends EventEmitter {
|
|
|
208
209
|
this.cores.delete(id)
|
|
209
210
|
})
|
|
210
211
|
core.once('close', () => {
|
|
212
|
+
this.emit('core-close', core)
|
|
211
213
|
this.cores.delete(id)
|
|
212
214
|
})
|
|
215
|
+
core.on('conflict', (len, fork, proof) => {
|
|
216
|
+
this.emit('conflict', core, len, fork, proof)
|
|
217
|
+
})
|
|
213
218
|
|
|
214
219
|
return { from: core, keyPair, auth }
|
|
215
220
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "corestore",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.4.0",
|
|
4
4
|
"description": "A Hypercore factory that simplifies managing collections of cores.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"b4a": "^1.3.1",
|
|
33
|
-
"hypercore": "^10.3
|
|
33
|
+
"hypercore": "^10.5.3",
|
|
34
34
|
"hypercore-crypto": "^3.2.1",
|
|
35
35
|
"safety-catch": "^1.0.1",
|
|
36
36
|
"sodium-universal": "^3.0.4",
|