Last active
May 8, 2019 20:29
-
-
Save paps/fab9796465948b021e2f4b93db85ff6c to your computer and use it in GitHub Desktop.
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
(async () => { | |
const onDbLoad = async () => { | |
const output = { | |
indexedDb: {}, | |
} | |
const server = await db.open({server: "keyval-store"}) | |
const keys = await server.keyval.query().all().keys().execute() | |
for (const key of keys) { | |
output.indexedDb[key] = await server.keyval.get(key) | |
} | |
output.localStorage = Object.keys(localStorage).reduce(function(obj, str) { | |
obj[str] = localStorage.getItem(str) | |
return obj | |
}, {}) | |
console.log(JSON.stringify(output, null, 2)) | |
} | |
const script = document.createElement("script") | |
script.type = "text/javascript" | |
script.src = "https://rawcdn.githack.com/aaronpowell/db.js/11b4b071573e571389655927f8574b2b89723b04/dist/db.min.js" | |
script.addEventListener("load", onDbLoad) | |
document.getElementsByTagName("head")[0].appendChild(script) | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment