question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

add databases interface to IDBFactory

See original GitHub issue

Search Terms

indexDB types

Suggestion

I would like to add to the IDBFactory interface the databases function

Use Cases

I was encountering an issue when I wanted to delete all the existing indexedDBs on my client application. For instance, if the user signs out, I want delete all the data and I don’t want to hard code the name of the databases in the code. So I did something like this:

    const dbKeys = await (window.indexedDB as any).databases();
    for (let key of dbKeys) {
      indexedDB.deleteDatabase(key.name);
    }

Examples

in lib.dom.d.ts:

interface IDBFactory {
...
databases(name: string): IDBDatabase[];
}

interface IDBDatabase {
name: string;
version: number;
}

Checklist

My suggestion meets these guidelines:

  • This wouldn’t be a breaking change in existing TypeScript/JavaScript code
  • This wouldn’t change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn’t a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript’s Design Goals.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
hikarino-mycommented, Mar 17, 2020

Why do you have to create an issue in the w3c repo? Editor’s Draft for Indexed Database API 3.0 (which includes implementation of IDBFactory#databases) already exists. https://w3c.github.io/IndexedDB/#factory-interface

The only thing we have to do is to just wait for the Draft to be published as Candidate recommendation or the browsers implementation(FireFox and safari). Or, if the TS team think this feature can be added to the lib.dom.d.ts even it is in Draft stage.

0reactions
fritzschoffcommented, Mar 17, 2020

ah okay sorry, I misinterpreted your comment!

Read more comments on GitHub >

github_iconTop Results From Across the Web

IDBFactory.databases() - Web APIs - MDN Web Docs
The databases method of the IDBFactory interface returns a list representing all the available databases, including their names and versions.
Read more >
Indexed Database API 3.0 - W3C
Database objects are accessed through methods on the IDBFactory interface. A single object implementing this interface is present in the ...
Read more >
IDbFactory Interface - NReco
Represents factory for creating db-specific ADO. ... IDbFactory Interface, NReco.Data Class Library Documentation ... Add new constant parameter.
Read more >
IDbConnectionFactory Interface (System.Data.Entity ...
SqlCeConnectionFactory is used to create connections to Microsoft SQL Server Compact Editions. Other implementations for other database servers can be added as ...
Read more >
browserbase - npm
Browserbase is a wrapper around the IndexedDB browser database which makes it ... I will attempt to summarize the IndexedDB interfaces and how...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found