wasm-bindgen icon indicating copy to clipboard operation
wasm-bindgen copied to clipboard

web_sys::IdbFactory is missing databases method

Open chairmank opened this issue 9 months ago • 0 comments

This is a minor proposal for a non-breaking enhancement to web_sys::IdbFactory.

In the IndexedDB specification, the IDBFactory interface has a databases method:

Returns a promise which resolves to a list of objects giving a snapshot of the names and versions of databases within the storage key.

This API is intended for web applications to introspect the use of databases, for example to clean up from earlier versions of a site’s code. Note that the result is a snapshot; there are no guarantees about the sequencing of the collection of the data or the delivery of the response with respect to requests to create, upgrade, or delete databases by this context or others.

I believe that it would be straightforward to add the Promise<sequence<IDBDatabaseInfo>> databases(); method definition to webidls/enabled/IDB.webidl and generate the corresponding pub fn databases(this: &IdbFactory,) -> Result<::js_sys::Promise, JsValue>; method in src/features/gen_IdbFactory.rs. I volunteer myself to open a pull request.

chairmank avatar Feb 21 '25 23:02 chairmank