indexeddb-aol

1.0.0 • Public • Published

Usage

var IndexedDBAOL = require('indexeddb-aol')
var assert = require('assert')

var aol = new IndexedDBAOT({name: 'test-log'})

// Append an entry.
db.append({x: 1}, function (error, index) {
  assert.ifError(error)
  assert.equal(index, 0)

  // Append another entry.
  db.append({y: 2}, function (error, index) {
    assert.ifError(error)
    assert.equal(index, 1)

    // Count entries on the log.
    db.count(function (error, count) {
      assert.ifError(error)
      assert.equal(count, 2)

      // Iterate entries...
      var iterated = []
      db.iterate(
        1, // ...starting from index 1.
        function iterate (index, entry, done) {
          iterated.push(entry)
          done()
        },
        function (error) {
          assert.ifError(error)
          assert.deepEqual(iterated, [{y: 2}])

          // Destroy the database.
          db.destroy(function () {
            // ...
          })
        }
      )
    })
  })
})

Licensing

This package is to free to use in open source under the terms of the License Zero Reciprocal Public License.

Licenses for use in closed and proprietary software are available via licensezero.com.

L0

Readme

Keywords

none

Package Sidebar

Install

npm i indexeddb-aol

Weekly Downloads

1

Version

1.0.0

License

SEE LICENSE IN LICENSE

Unpacked Size

13.5 kB

Total Files

8

Last publish

Collaborators

  • kemitchell