FontFaceSet: sự kiện loading
Baseline
2025
Newly available
Since December 2025, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
Note: This feature is available in Web Workers.
Sự kiện loading kích hoạt khi tài liệu bắt đầu tải font.
Cú pháp
Dùng tên sự kiện trong các phương thức như addEventListener(), hoặc đặt thuộc tính event handler.
js
addEventListener("loading", (event) => { })
onloading = (event) => { }
Ví dụ
Trong ví dụ sau, khi font Ephesis bắt đầu tải, "Font is loading…" được in ra console.
js
document.fonts.onloading = () => {
console.log("Font is loading");
};
(async () => {
await document.fonts.load("16px Ephesis");
})();
Thông số kỹ thuật
| Specification |
|---|
| CSS Font Loading Module Level 3> # dom-fontfaceset-onloading> |