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

Commit

Permalink
Add append event support (#34)
Browse files Browse the repository at this point in the history
* Add append event support

* Latest orbit-db-store version.
  • Loading branch information
vaultec81 authored May 11, 2020
1 parent 3023d4a commit 9609d71
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "orbit-db-eventstore",
"version": "1.8.0",
"version": "1.9.0",
"description": "Eventlog for orbit-db",
"main": "src/EventStore.js",
"homepage": "https://github.com/orbitdb/orbit-db-eventstore",
Expand All @@ -21,7 +21,7 @@
"author": "Haad",
"license": "MIT",
"dependencies": {
"orbit-db-store": "~3.1.0"
"orbit-db-store": "~3.3.0"
},
"devDependencies": {
"standard": "^12.0.1"
Expand Down
6 changes: 4 additions & 2 deletions src/EventStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ class EventStore extends Store {
constructor (ipfs, id, dbname, options = {}) {
if (options.Index === undefined) Object.assign(options, { Index: EventIndex })
super(ipfs, id, dbname, options)
this._type = 'eventlog'
this._type = 'eventlog';
this.events.on("log.op.ADD", (address, hash, payload) => {
this.events.emit("db.append", payload.value)
})
}

add (data, options = {}) {
Expand All @@ -23,7 +26,6 @@ class EventStore extends Store {
get (hash) {
return this.iterator({ gte: hash, limit: 1 }).collect()[0]
}

iterator (options) {
const messages = this._query(options)
let currentIndex = 0
Expand Down

0 comments on commit 9609d71

Please sign in to comment.