This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Assuming https://github.com/jakearchibald/idb-keyval has been used for key-value entries, | |
// the following is about the minimum code needed to read the value for a single key (w/o the lib.) | |
// Usage: `readKey('name').then(function(name) { console.log(name); });` | |
function readKey(key) { | |
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB; | |
if (!indexedDB) return Promise.reject(new Error('IndexedDB not available')); | |
return new Promise(function(resolve, reject) { | |
var open = indexedDB.open('keyval-store', 1); | |