1.0.0 • Published 3 years ago
modern-idb v1.0.0
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()
1.0.0
3 years ago