Skip to content

Instantly share code, notes, and snippets.

@dalmaer
Created May 11, 2010 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dalmaer/397409 to your computer and use it in GitHub Desktop.
Save dalmaer/397409 to your computer and use it in GitHub Desktop.
var db = indexedDB.open('books', 'Book store', false);
if (db.version !== '1.0') {
var olddb = indexedDB.open('books', 'Book store');
olddb.createObjectStore('books', 'isbn');
olddb.createIndex('BookAuthor', 'books', 'author', false);
olddb.setVersion("1.0");
}
// db.version === "1.0";
var index = db.openIndex('BookAuthor');
var matching = index.get('fred');
if (matching)
report(matching.isbn, matching.name, matching.author);
else
report(null);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment