Skip to content

Instantly share code, notes, and snippets.

@luke-denton-aligent
Last active November 16, 2016 04:01
Show Gist options
  • Save luke-denton-aligent/4c8e91c6c9b9ba2017aaa157ff50008a to your computer and use it in GitHub Desktop.
Save luke-denton-aligent/4c8e91c6c9b9ba2017aaa157ff50008a to your computer and use it in GitHub Desktop.
This snippet shows how to read from an object store in IndexedDB
// Offline Web Applications course on Udacity https://classroom.udacity.com/courses/ud899
//Following on from https://gist.github.com/luke-denton/55be283cbddf6f0c0d362fd95fc9280a
dbPromise.then(function(db) {
var tx = db.transaction('keyval');
var keyValStore = tx.objectStore('keyval');
return keyValStore.get('hello');
}).then(function(val) {
console.log(val); //Log the value of the key 'hello'
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment