This repository was archived by the owner on Sep 30, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " orbit-db-eventstore" ,
3- "version" : " 1.5.0-rc3 " ,
3+ "version" : " 1.5.0" ,
44 "description" : " Eventlog for orbit-db" ,
55 "main" : " src/EventStore.js" ,
66 "homepage" : " https://github.com/orbitdb/orbit-db-eventstore" ,
2121 "author" : " Haad" ,
2222 "license" : " MIT" ,
2323 "dependencies" : {
24- "orbit-db-store" : " next "
24+ "orbit-db-store" : " ~2.6.0 "
2525 },
2626 "devDependencies" : {
2727 "standard" : " ^12.0.1"
Original file line number Diff line number Diff line change @@ -34,28 +34,28 @@ const IPFS = require('ipfs')
3434const OrbitDB = require (' orbit-db' )
3535
3636const ipfs = new IPFS ()
37- const orbitdb = new OrbitDB (ipfs)
37+ const orbitdb = await OrbitDB . createInstance (ipfs)
3838```
3939
4040Get a log database and add an entry to it:
4141
4242``` javascript
43- const log = orbitdb .eventlog (' haad.posts' )
43+ const log = await orbitdb .eventlog (' haad.posts' )
4444log .add ({ name: ' hello world' })
4545 .then (() => {
46- const items = log .iterator ().collect ()
47- items .forEach (( e ) => console .log (e .name ))
46+ const items = log .iterator ().collect (). map ( e => e . payload . value )
47+ items .forEach (e => console .log (e .name ))
4848 // "hello world"
4949 })
5050```
5151
5252Later, when the database contains data, load the history and query when ready:
5353
5454``` javascript
55- const log = orbitdb .eventlog (' haad.posts' )
55+ const log = await orbitdb .eventlog (' haad.posts' )
5656log .events .on (' ready' , () => {
57- const items = log .iterator ().collect ()
58- items .forEach (( e ) => console .log (e .name ))
57+ const items = log .iterator ().collect (). map ( e => e . payload . value )
58+ items .forEach (e => console .log (e .name ))
5959 // "hello world"
6060})
6161```
You can’t perform that action at this time.
0 commit comments