FontFaceSet: sự kiện loadingdone
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Note: This feature is available in Web Workers.
Sự kiện loadingdone kích hoạt khi tài liệu đã tải xong tất cả 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("loadingdone", (event) => { })
onloadingdone = (event) => { }
Ví dụ
Trong ví dụ sau, khi font Ephesis tải xong, "Font loading complete" được in ra console.
js
document.fonts.onloadingdone = () => {
console.log("Font loading complete");
};
(async () => {
await document.fonts.load("16px Ephesis");
})();
Thông số kỹ thuật
| Specification |
|---|
| CSS Font Loading Module Level 3> # dom-fontfaceset-onloadingdone> |