Skip to content
This repository was archived by the owner on Sep 30, 2023. It is now read-only.

Commit 9609d71

Browse files
authored
Add append event support (#34)
* Add append event support * Latest orbit-db-store version.
1 parent 3023d4a commit 9609d71

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "orbit-db-eventstore",
3-
"version": "1.8.0",
3+
"version": "1.9.0",
44
"description": "Eventlog for orbit-db",
55
"main": "src/EventStore.js",
66
"homepage": "https://github.com/orbitdb/orbit-db-eventstore",
@@ -21,7 +21,7 @@
2121
"author": "Haad",
2222
"license": "MIT",
2323
"dependencies": {
24-
"orbit-db-store": "~3.1.0"
24+
"orbit-db-store": "~3.3.0"
2525
},
2626
"devDependencies": {
2727
"standard": "^12.0.1"

src/EventStore.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ class EventStore extends Store {
99
constructor (ipfs, id, dbname, options = {}) {
1010
if (options.Index === undefined) Object.assign(options, { Index: EventIndex })
1111
super(ipfs, id, dbname, options)
12-
this._type = 'eventlog'
12+
this._type = 'eventlog';
13+
this.events.on("log.op.ADD", (address, hash, payload) => {
14+
this.events.emit("db.append", payload.value)
15+
})
1316
}
1417

1518
add (data, options = {}) {
@@ -23,7 +26,6 @@ class EventStore extends Store {
2326
get (hash) {
2427
return this.iterator({ gte: hash, limit: 1 }).collect()[0]
2528
}
26-
2729
iterator (options) {
2830
const messages = this._query(options)
2931
let currentIndex = 0

0 commit comments

Comments
 (0)