Back to Content

XRAnchor: delete() method

files/en-us/web/api/xranchor/delete/index.md

latest704 B
Original Source

{{APIRef("WebXR Device API")}}{{SeeCompatTable}}{{SecureContext_Header}}

The delete() method of the {{domxref("XRAnchor")}} interface removes an anchor. This can be useful when an application is no longer interested in receiving updates to an anchor.

Syntax

js-nolint
delete()

Parameters

None.

Return value

None ({{jsxref("undefined")}}).

Examples

Removing all anchors

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();

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}