This pull request is based on #128. The following description was originally posted as a comment.
After some additional reading on the CSS Font Loading API and I've come up with a working example that uses Promises instead of events for a more flexible solution.
With the use of Promises, modules wait on the FontFace's they need. This way, they react accordingly if "eager loaded" or "lazy loaded".
Note that the code may not be production ready. Requires further testing across use cases and environments.
This pull request is based on #128. The following description was originally posted as a comment.
After some additional reading on the CSS Font Loading API and I've come up with a working example that uses Promises instead of events for a more flexible solution.
With the use of Promises, modules wait on the
FontFace
's they need. This way, they react accordingly if "eager loaded" or "lazy loaded".Note that the code may not be production ready. Requires further testing across use cases and environments.
References
@font-face
source order when used with preload, Nooshu, 2021Added
FontFace
entries.Changed
FontFace.family
value.Notes
<span>
elements withFaceFace.load()
andFaceFace.loaded
to eagerly load fonts.loadFonts()
(see 'app.js').whenReady()
(see 'Example.js').Todo
Example
frommodules.js
andindex.html
.