add databases interface to IDBFactory
See original GitHub issueSearch 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:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.ah okay sorry, I misinterpreted your comment!