Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function displayNotes() {
var transaction = db.transaction(["note"], IDBTransaction.READ);
var content="<ul>";
transaction.oncomplete = function(event) {
console.log("All done!");
$("#noteList").html(content);
};
transaction.onerror = function(event) {
// Don't forget to handle errors!
console.dir(event);
};
var objectStore = transaction.objectStore("note");
objectStore.openCursor().onsuccess = function(event) {
var cursor = event.target.result;
if (cursor) {
content += "<li data-key=\""+cursor.key+"\"><span class=\"label\">"+cursor.value.title+"</span>";
content += " <a class=\"delete\">[Delete]</a>";
content +="</li>";
cursor.continue();
}
else {
content += "</ul>";
console.log("Done with cursor");
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment