Closed domenic closed 3 years ago
Hmm, the code examples seem to treat it as if it returns a FontIterator
... but I'm not sure how you'd do the algorithm that way.
I guess you could move all the asynchronous permission-checking stuff into the first invocation of "get the next iterator result", and have query()
just return a not-yet-initialized object? In that case I don't think it should be a method, but instead it should be something like navigator.fonts
. (See also #33.)
This also confused me. Is there any reason this has to be an async iterator to begin with? I realize we don't want to load the individual fonts, but it seems gathering all the relevant font names + pointers to data can be done in a single request?
I'd also like to see justification for this being an async iterator.
However, if there's good reason, I don't see an issue with the permission checking stuff happening on iteration. It's kinda nice that it can happen per iteration, as it can reject if permission is revoked.
https://github.com/WICG/local-font-access/issues/27 suggests we might want options to query()
, or a method like matchAll()
, so it might still make sense as a method rather than a property.
Did some thinking around the async iterator stuff in https://github.com/WICG/local-font-access/issues/51
No longer an async iterator.
The IDL says that
query()
returns aFontIterator
. However the spec algorithm forquery()
says that it returns aPromise<FontIterator>
.