FontFaceSet: thuộc tính ready
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
Note: This feature is available in Web Workers.
Thuộc tính chỉ đọc ready của giao diện FontFaceSet trả về Promise resolve với FontFaceSet đã cho.
Promise chỉ resolve sau khi tài liệu hoàn tất tải font, các thao tác bố cục trang hoàn thành, và không cần tải thêm font nào nữa.
Giá trị
Promise resolve với FontFaceSet đã cho.
Ví dụ
Trong ví dụ sau, giá trị của ready được in ra console sau khi promise resolve.
js
async function isReady() {
let ready = await document.fonts.ready;
console.log(ready);
}
isReady();
Thông số kỹ thuật
| Specification |
|---|
| CSS Font Loading Module Level 3> # dom-fontfaceset-ready> |