Flourish font watcher
The function exported from this module will call
window.template.update()
(or another function) when any new
fonts are loaded.
How to install
npm install -s @flourish/font-watcher
Then import it with:
import addFontWatcher from "@flourish/font-watcher";
Usage
If no callback is specified, then addFontWatcher
will call
window.template.update()
whenever it detects that a new font
has been loaded:
addFontWatcher();
If you supply a callback, then it will be called with a FontFaceSetLoadEvent object as the parameter. For example, you can do:
addFontWatcher(function () {
console.log("Fonts have loaded");
});