Closed inexorabletash closed 9 years ago
I don't like .promise
either. To list the other stuff on IDBRequest, we're competing with:
.readyState
("pending" or "done").result
(throws if pending, undefined if error).error
(throws if pending, null if no error)My concern about .ready
, .complete
or .done
specifically is that the promise holds the result value, not just the signal that the request is complete (unlike on the transaction), and thus accessing the value with those will read awkwardly with await
syntax.
Oooooh... how about .value
?
let x = await store.get(key).value;
let count = await store.count(range).value;
let cursor = await index.openCursor().value;
Possible objection: IDBCursor has .value
as a synchronous accessor (along with .key
etc)
.value
is also a bit odd for put calls when the result isn't actually used, e.g.
await store.put(data).value;
...
My concern about .ready, .complete or .done specifically is that the promise holds the result value, not just the signal that the request is complete
I think this is fine. navigator.serviceWorker.ready
resolves with a registration, .ready
in the font loading API resolves with a font face object.
Done - .ready
it is.
Currently
.promise
.@domenic suggests
.ready
,.complete
,.done
but has no preferences