2.0.0 • Published 3 years ago

orbit-db-counterstore v2.0.0

Weekly downloads
1,197
License
MIT
Repository
github
Last release
3 years 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

3 years ago

2.0.0

3 years ago

1.12.2-3f123be.0

3 years ago

2.0.1-f77db13.0

3 years ago

1.12.1

4 years ago

1.12.0

5 years ago

1.11.0

5 years ago

1.10.0

5 years ago

1.9.0

6 years ago

1.8.0

6 years ago

1.7.0

6 years ago

1.6.0

6 years ago

1.6.0-rc3

6 years ago

1.5.2

6 years ago

1.6.0-rc2

6 years ago

1.6.0-rc1

6 years ago

1.5.1

7 years ago

1.4.1

7 years ago

1.5.0

7 years ago

1.5.0-rc3

7 years ago

1.5.0-rc.2

7 years ago

1.5.0-rc.1

7 years ago

1.4.0

8 years ago

1.3.1

8 years ago

1.3.0

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.2.0

9 years ago

0.1.8

9 years ago

0.1.7

9 years ago

0.1.6

9 years ago

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.16

9 years ago

0.0.15

9 years ago

0.0.14

9 years ago

0.0.13

9 years ago

0.0.12

9 years ago

0.0.11

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago