Interface for Backbone-db compatible adapters that can store indices.
Interface that compliant backbone-db adapter must implement. Interface defines the following methods:
Adds a key to index.
Read keys from the index.
Read keys from multiple indexes.
Remove models' keys from index.
Removes the index completely.
Check if key exists in the index.
Get number of keys in the index.
Return the score of key in the index.
Backbone-db adapter that implements IndexedDBAdapterInterface, storing indexes in memory/localStorage
var IndexingDBLocal = require('backbone-db-indexing-adapter').IndexingDBLocal;
var store = new IndexingDBLocal('test');
Mixin for Collections that use IndexedDBAdapterInterface compliant backbone-db adapter
var TestIndexedCollection = MyCollection.extend(
_.extend({}, IndexedCollectionMixin, {
indexDb: store
})
);
var c = new TestIndexedCollection();
return c.readFromIndex().then(...);
npm run test