modern-idb
v1.0.0
Published
Modern [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) wrapper with Promises, AsyncIterables and strict typing.
Maintainers
Readme
Modern-IDB
Modern IndexedDB wrapper with Promises, AsyncIterables and strict typing.
Motivation
IndexedDB API was available in browsers 3 years before Promises. Current event-based API is verbose and not as convenient to use in modern codebases as async/await.
Changes
IDBRequest<T>is converted toPromise<T>(except forIDBRequest<IDBCursor | IDBCursorWithValue>)IDBTransaction<T>is extended with apromise: Promise<T>property to allow simpler async/await code..openCursor()and.openKeyCursor()return anAsyncIterable<Cursor | CursorWithValue>openDatabase()has a generic to specify DB schema.- Automatic versioning and DB migrations with
migrationsargument ofopenDatabase()
