W3C home > Mailing lists > Public > www-style@w3.org > February 2016

Re: [Font Loading] FontFaceSet's Ready Promise

From: Cameron McCormack <cam@mcc.id.au>
Date: Sat, 6 Feb 2016 15:45:18 +1100
To: "Myles C. Maxfield" <mmaxfield@apple.com>
Cc: www-style@w3.org
Message-ID: <20160206044518.GA22370@wok.mcc.id.au>
Hi Myles,

Myles C. Maxfield:
> FontFaceSet exposes a "ready" promise attribute, which can therefore
> only be resolved once. However, fonts may start and end loading at
> any time. Therefore, this promise will give unintuitive and incorrect
> information much of the time. Instead, the mechanism used to notify
> script when all fonts in the set have finished loading should be
> achieved via sending events.

That particular Promise object will, but a new Promise object is created
and exposed through FontFaceSet.ready when a loading starts again (after
a period of loading being complete).

At any point, if you write

  document.fonts.ready.then(…)

you’ll be guaranteed to have your callback invoked either immediately,
if there are no loads happening currently, or when the current loads
complete.  Storing away the document.fonts.ready Promise to call then()
on at a later point wouldn’t be useful.

-- 
Cameron McCormack ≝ http://mcc.id.au/
Received on Saturday, 6 February 2016 04:45:56 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:09:00 UTC