indexeddb-promises
indexeddb-promises copied to clipboard
Proposal for incremental support for Promises in the Indexed DB API
Inspired by the work over in https://github.com/inexorabletash/web-locks and suggested by @dominiccooney at TPAC 2016... Rather than the confusing usage of waitUntil(), we could do something like: ```js db.transaction(scope, mode, async...
Just capturing a quick note here: I was worried about the weirdness of this proposal during cursor iteration, where IDBRequest.promise returns a new Promise when continue/advance are called. But see:...
Over on https://gist.github.com/inexorabletash/8c122c84a65de65c35b3 @domenic objected to including `then()` and `catch()` helpers on IDBRequest. The pro of having those is that IDBRequest becomes a _thennable_ which makes usage cleaner in promise...
Let's dig up the old example of get-fetch-put: ``` js tx.waitUntil((async () => { const url = await tx.objectStore('urls').get(k); const request = await fetch(url); const text = await request.text(); await...
With the event-based API, an error on a request that is not prevented causes the transaction to abort: ``` js var tx = db.transaction('team', 'readwrite'); var store = tx.objectStore('team'); var...
Options include: 1. a Promise dependent on the promise the transaction is waiting on 2. just whatever is passed in 3. undefined 1 is redundant with `.complete` 2 is not...
As hinted at in #9 the state transitions are complicated. If all waiting promises resolve while performing event firing (which will dispatch to a target, execute microtasks, dispatch to the...
Need to specify the behavior for: - A transaction that's in the "waiting" state - All of the promises in the transaction's extend lifetime promises fulfill - There are still...
Hi! I'm wondering if it makes sense to turn `IDBCursor` into an [async iterable](https://github.com/tc39/proposal-async-iteration), once that proposal crystallizes a bit. The `getAll` example in the readme is already quite nice,...
Implicitly, the proposal allows for: ``` js let connection = await indexedDB.open('db').ready; ``` But that doesn't handle initial opens/upgrades, where you need to watch the `upgradeneeded` event on the request....