LazyStorage is an abstraction layer for indexeddb and webdb. A working is example is in the example dir.
var lz = new LazyStorage('Spreeuw',1,{
{
'Waarnemingen' : {
'name': 'Waarnemingen'
}
}
}
);
The constructor takes database name, version and a schema object as arguments. The schema object can be an array(or object) of table descriptions. Each description is an object with at least the property name
[
{
'name' : 'Tiles'
}
]
Operations
//save record
$("#obsform").on("submit",function(e) {
e.preventDefault();
var data = $(this).serializeObject();
lz.save("Waarnemingen",data,function(record) { })
});
//delete record
lz.rm("Waarnemingen",{'guid':$("#record_options").data("guid")},function(e) {
$( "#record_options" ).popup( "close" );
$( "body" ).pagecontainer("change",$("#waarnemingen"),{'allowSamePageTransition': true });
});
//get all
lz.getAll("Waarnemingen",function(records) {
});
//update
lz.update("Waarnemingen",record,function(record) {
});