Ink: phương thức requestPresenter()
Khả dụng hạn chế
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Phương thức requestPresenter() của giao diện Ink trả về một Promise thực hiện với một đối tượng DelegatedInkTrailPresenter để xử lý việc hiển thị các nét.
Cú pháp
requestPresenter(param)
Tham số
paramOptional-
Một đối tượng chứa thuộc tính sau:
presentationAreaOptional-
Một
Elementbên trong phạm vi hiển thị các nét mực được giới hạn (cụ thể là hộp viền của phần tử). Nếuparamkhông được bao gồm, hoặcpresentationAreađược đặt thànhnull, việc hiển thị mực mặc định bị giới hạn trong viewport chứa.
Giá trị trả về
Một Promise phân giải thành một phiên bản đối tượng DelegatedInkTrailPresenter.
Ngoại lệ
ErrorDOMException-
Lỗi được ném ra và thao tác bị hủy nếu
presentationAreakhông phải làElementhợp lệ, hoặc không nằm trong cùng tài liệu với đối tượngInkliên quan.
Ví dụ
async function inkInit() {
const ink = navigator.ink;
let presenter = await ink.requestPresenter({ presentationArea: canvas });
// …
}
Thông số kỹ thuật
| Thông số kỹ thuật |
|---|
| Ink API> # dom-ink-requestpresenter> |