FontFaceSet: loading イベント
loading
イベントは、文書がフォントの読み込みを始めるときに発行されます。
構文
このイベント名を addEventListener()
などのメソッドで使用するか、イベントハンドラープロパティを設定するかしてください。
js
addEventListener("loading", (event) => {});
onloading = (event) => {};
例
次の例では、フォント Ephesis
が読み込まれ始めると、"Font is loading..." とコンソールに表示されます。
js
document.fonts.onloading = () => {
console.log("Font is loading");
};
(async () => {
await document.fonts.load("16px Ephesis");
})();
仕様書
Specification |
---|
CSS Font Loading Module Level 3 # dom-fontfaceset-onloading |
ブラウザーの互換性
BCD tables only load in the browser