Created
August 3, 2019 07:57
-
-
Save jcblw/9ea92db02d63e4f35de9b3a3cce02ecb to your computer and use it in GitHub Desktop.
A script you can paste in your console to logout all values in an indexDB table
This file contains 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
// See bottom to see input variables | |
(async function(w, d, v, t, c) { | |
const s = "font-size:18px;"; | |
const h = `color:#F06E1D;${s}`; | |
const getRows = () => { | |
return new Promise(resolve => { | |
const r = []; | |
w.indexedDB.open(d, v).onsuccess = event => { | |
event.target.result | |
.transaction(t) | |
.objectStore(t) | |
.openCursor().onsuccess = event => { | |
var cursor = event.target.result; | |
if (cursor) { | |
r.push(cursor.value); | |
cursor.continue(); | |
} else { | |
resolve(r); | |
} | |
}; | |
}; | |
}); | |
}; | |
let r; | |
try { | |
r = await getRows(); | |
} catch (e) { | |
c.error(e); | |
} | |
rows = r; | |
c.log(`%c DB "${d}" Table "${t}"`, s); | |
c.log("%c content added to rows variable", s); | |
c.log('%c to copy data to your clipboard run %ccopy(rows)', s, h); | |
c.log({ rows }); | |
copy(rows); | |
})(window, DB_NAME, DB_VERSION, TABLE_NAME, console); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment