CSS: thuộc tính tĩnh paintWorklet

Limited availability

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.

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

Thuộc tính chỉ đọc tĩnh paintWorklet của giao diện CSS cung cấp quyền truy cập vào worklet vẽ, nơi tạo ảnh theo cách lập trình ở những nơi một thuộc tính CSS mong đợi một tệp.

Giá trị

Đối tượng Worklet liên kết.

Ví dụ

Ví dụ sau minh họa cách tải một worklet vẽ từ tệp js của nó và thực hiện việc này bằng cách phát hiện tính năng.

js
if ("paintWorklet" in CSS) {
  CSS.paintWorklet.addModule("checkerboard.js");
}

Thông số kỹ thuật

Specification
CSS Painting API Level 1
# dom-css-paintworklet

Tương thích trình duyệt

Xem thêm