Re: Last Call for "CSS Font Loading Module Level 3"

On Tue, May 27, 2014 at 10:41 AM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
>> Separately, FontFace.loaded seems to fulfill the same purpose as
>> FontFaceSet.ready(). I.e. both indicate that the object is done
>> loading/parsing/applying its data. It seems more consistent if they
>> had the same name, and if both were either an attribute or both were a
>> function.
>
> No, the two do completely different (but related) things.  Why do you
> think they're identical?  One fulfills when a *particular* FontFace
> object finishes loading, the other repeatedly fulfills whenever the
> set of loading fonts goes from non-zero to zero.

Semantically they both indicate "the async processing that this object
was doing is done". Yes, in one instance it just signals that a given
FontFace instance is ready to be used, in the other that the full
FontFaceSet is ready. Putting the properties on different objects is
enough to indicate that, the difference in name doesn't seem
important?

In general it would be nice if we started establishing a pattern of a
.ready() method (or property) on various objects to indicate that they
are ready to be used. Rather than authors knowing that they need to
listen to "load" events on images, "success" events on
IDBOpenRequests, .loaded promise on FontFace objects and .ready()
promise on FontFaceSets.

/ Jonas

Received on Tuesday, 27 May 2014 18:45:41 UTC