Back to Content

XRHitTestSource: cancel() method

files/en-us/web/api/xrhittestsource/cancel/index.md

latest690 B
Original Source

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

The cancel() method of the {{domxref("XRHitTestSource")}} interface unsubscribes a hit test.

Syntax

js-nolint
cancel()

Parameters

None.

Return value

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

Examples

Unsubscribe from hit test

The cancel() method unsubscribes from a hit test source. Since the {{domxref("XRHitTestSource")}} object will no longer be usable, you can clean up and set it to null.

js
hitTestSource.cancel();
hitTestSource = null;

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}