backbone.lovefield

0.1.10 • Public • Published

backbone.lovefield

lovefield backend for backbone.

This adapter is inspired by backbone.localStorage and backbone-indexeddb. I wanted to use more than localStorage, yet backbone-indexeddb wouldn't play well with backbone.validation.

import Backbone from 'backbone';
import lf from 'lovefield';
import {LoveStore} from 'backbone.lovefield';
 
// Create schema and make sure connection
// is available before defining models and collections.
// sb = lf.schema.create('dbname', 1);
// conn = undefined;
// sb.connect().then(function (db){conn=db;})
 
const TableStore = new LoveStore(conn, 'tablename');
 
const MyModel = Backbone.Model.extend({
    loveStore: TableStore
});
 
const MyCollection = Backbone.Collection.extend({
    loveStore: TableStore,
    model: MyModel
});
 

Readme

Keywords

Package Sidebar

Install

npm i backbone.lovefield

Weekly Downloads

0

Version

0.1.10

License

UNLICENSED

Unpacked Size

41 kB

Total Files

9

Last publish

Collaborators

  • umeboshi