2.0.0 • Published 1 year ago

orbit-db-counterstore v2.0.0

Weekly downloads
1,197
License
MIT
Repository
github
Last release
1 year ago

orbit-db-counterstore

Gitter Matrix Discord npm version

Counters database for OrbitDB

A simple counters database. Useful for example counting events separate from data.

Used in orbit-db.

Table of Contents

Install

This project uses npm and nodejs

npm install orbit-db ipfs

Usage

First, create an instance of OrbitDB:

import * as IPFS from 'ipfs'
import OrbitDB from 'orbit-db'

const ipfs = new IPFS()
const orbitdb = OrbitDB.createInstance(ipfs)

Get a log database and add an entry to it:

const counter = await orbitdb.counter('visitors')
await counter.inc()
console.log(counter.value)
// 1
await counter.inc(4)
console.log(counter.value)
// 5

Later, when the database contains data, load the history and query when ready:

const counter = await orbitdb.counter('visitors')
counter.events.on('ready', () => {
  await counter.inc()
  console.log(counter.value)
  // 6
})

See example/index.html for a detailed example. Note that to run this example, you need to have a local IPFS daemon running at port 5001.

API

See OrbitDB's API Documentation for full details.

Contribute

Please, feel free to contribute! Take a look at the issues, and comment on an existing issue or create a new one if you have questions, bugs, or suggestions. For larger PRs, open an issue first if you could - drive-by PRs are also welcomed.

Please abide by the Code of Conduct. For more on contributing to OrbitDB, check out the docs in orbitdb/welcome.

License

MIT © 2016-2018 Protocol Labs Inc., Haja Networks Oy

2.0.1-490309f.0

1 year ago

2.0.0

1 year ago

2.0.1-f77db13.0

1 year ago

1.12.1

2 years ago

1.12.0

4 years ago

1.11.0

4 years ago

1.10.0

4 years ago

1.9.0

4 years ago

1.8.0

4 years ago

1.7.0

4 years ago

1.6.0

5 years ago

1.6.0-rc3

5 years ago

1.5.2

5 years ago

1.6.0-rc2

5 years ago

1.6.0-rc1

5 years ago

1.5.1

5 years ago

1.4.1

5 years ago

1.5.0

5 years ago

1.5.0-rc3

5 years ago

1.5.0-rc.2

5 years ago

1.5.0-rc.1

5 years ago

1.4.0

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.2.0

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.16

8 years ago

0.0.15

8 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago