jakearchibald / idb

IndexedDB, but with promises
https://www.npmjs.com/package/idb
ISC License
6.29k stars 353 forks source link

Dump all objects #191

Closed septs closed 4 years ago

septs commented 4 years ago
const databases = (await indexedDB.databases?.()) ?? []
for (const { name, version } of databases) {
  const db = await openDB(name, version)
  const stores: Record<string, unknown[]> = {}
  for (const name of db.objectStoreNames) {
    stores[name] = await db.getAll(name)
  }
  console.log(name, version, stores)
}

Cannot read the second database

image

septs commented 4 years ago

image

openDB need design a open timeout options

jakearchibald commented 4 years ago

I tried to piece together a reduced example: https://static-misc-2.glitch.me/idb/two-databases-bug.html

It seems to work fine.

Please reopen when you have a reduced example that shows the issue.