You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 13, 2021. It is now read-only.
Rather than the confusing usage of waitUntil(), we could do something like:
db.transaction(scope,mode,asynctx=>{conststore=tx.objectStore('s');constvalue=awaitstore.get('key');constresponse=awaitfetch(`${url}?value=${value}');if(response.ok){awaitstore.put(awaitresponse.text(),'stuff');}// tx commits when this async function's promise resolves});
Lots of details to be worked out (e.g. what does transaction() return here? (IDBTransaction or Promise<void>) ? what do cursors look like, etc?)
(This is assuming we want to tackle promisifying transactions in the first place, vs. a completely revised API. Tracking it here for posterity.)
The text was updated successfully, but these errors were encountered:
I really like this as a way of 'fixing' the IDB API without breaking compatibility.
I think the return of transaction() can remain the same, but add a .complete promise to the IDBTransaction. The inner tx (shall we call it IDBPromiseTransaction?) won't have .complete, as it'd likely lead to deadlock.
I think we'd need something similar for opening the database:
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:
Lots of details to be worked out (e.g. what does
transaction()
return here?(IDBTransaction or Promise<void>)
? what do cursors look like, etc?)(This is assuming we want to tackle promisifying transactions in the first place, vs. a completely revised API. Tracking it here for posterity.)
The text was updated successfully, but these errors were encountered: