XRAnchor: phương thức delete()

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.

Phương thức delete() của giao diện XRAnchor xóa một anchor. Điều này có thể hữu ích khi ứng dụng không còn quan tâm đến việc nhận cập nhật cho một anchor nữa.

Cú pháp

js
delete()

Tham số

Không có.

Giá trị trả về

Không có (undefined).

Ví dụ

Xóa tất cả các anchor

js
let anchorsCollection = new Set();

// Upon creating anchors, add them to the Set
// anchorsCollection.add(anchor);

for (const anchor of anchorsCollection) {
  anchor.delete();
}

anchorsCollection.clear();

Thông số kỹ thuật

Specification
WebXR Anchors Module
# dom-xranchor-delete

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