Flight mode

feat. IndexedDB

So...

Well they suck

IndexedDB over localStorage

Basic API

var request = indexedDB.open('my-db', 1); request.onupgradeneeded = function (e) { var db = e.target.result; var store = db.createObjectStore('my-store', { keyPath: 'id', autoIncrement: true }); store.add({ firstName: 'Aaron', lastName: 'Powell' }); }; request.onsuccess = function (e) { var db = e.target.result; var transaction = db.transaction('my-store'); var store = transaction.objectStore('my-store'); var request = store.get(1); request.onsuccess = function (e) { console.log(e.target.result); }; };

Querying

var people = []; objectStore.openCursor().onsuccess = function (e) { var cursor = e.target.result; if (cursor) { people.push(cursor.value); cursor.continue(); } else { console.log(people); } };

Method in the madness

Better demo!

TodoMVC + Backbone

Browser support

Browsers github.com/axemclion/IndexedDBShim

Fin.

/

#