var fn = console.log.bind(console); // use it as callback
// define db schema
var schema = treo.schema()
.version(1)
.addStore('books', { key: 'isbn' })
.addIndex('byTitle', 'title', { unique: true })
.addIndex('byAuthor', 'author')
.version(2)
.getStore('books')
.addIndex('byYear', 'year')
.version(3)
.addStore('magazines')
.addIndex('byPublisher', 'publisher')
.addIndex('byFrequency', 'frequency');
// open db
var db = treo('library', schema)
.use(treoWebsql())
.use(treoPromise());
db.version; // 3
// put some data in one transaction
var books = db.store('books');
function getItem(){
Promise.all([
books.get('123456'),
books.get('234567'),
books.get('345678'),
]).then(function(records) {
console.log(records); // records.length == 3 Console says : [undefined, undefined, undefined]
books.count().then(function(count) {
console.log(count); // total count of records //Works!!!! says 3
});
});
}
Using your snippet code from the manual i tried: