Back to Content

XRSession: squeezeend event

files/en-us/web/api/xrsession/squeezeend_event/index.md

latest2.6 KB
Original Source

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

The WebXR event squeezeend is sent to an {{domxref("XRSession")}} when one of its input sources ends its primary action or when an input source that's in the process of handling an ongoing primary action is disconnected without successfully completing the action.

Primary squeeze actions include things like users pressing triggers or buttons, tapping a touchpad, speaking a command, or performing a recognizable gesture when using a video tracking system or handheld controller with an accelerometer.

Syntax

Use the event name in methods like {{domxref("EventTarget.addEventListener", "addEventListener()")}}, or set an event handler property.

js-nolint
addEventListener("squeezeend", (event) => { })

onsqueezeend = (event) => { }

Event type

An {{domxref("XRInputSourceEvent")}}. Inherits from {{domxref("Event")}}.

{{InheritanceDiagram("XRInputSourceEvent")}}

Event properties

In addition to the properties listed below, properties from the parent interface, {{domxref("Event")}}, are available.

  • {{domxref("XRInputSourceEvent.frame", "frame")}} {{ReadOnlyInline}}
    • : An {{domxref("XRFrame")}} object providing the needed information about the event frame during which the event occurred. This frame may have been rendered in the past rather than being a current frame. Because this is an event frame, not an animation frame, you cannot call {{domxref("XRFrame.getViewerPose", "XRFrame.getViewerPose()")}} on it; instead, use {{domxref("XRFrame.getPose", "getPose()")}}.
  • {{domxref("XRInputSourceEvent.inputSource", "inputSource")}} {{ReadOnlyInline}}
    • : An {{domxref("XRInputSource")}} object indicating which input source generated the input event.

Description

Trigger

Triggered when users stop squeezing the controller, making a hand gesture that mimes grabbing something, or using (squeezing) a trigger.

Use cases

The {{domxref("XRSession.squeezestart_event", "squeezestart")}} event is sent indicating that the user has begun a squeeze action.

If the primary squeeze action ends successfully, the session is sent a {{domxref("XRSession.squeeze_event", "squeeze")}} event.

A squeezeend event is sent to indicate that the squeeze action is no longer underway. This is sent whether the squeeze action succeeded or not.

Examples

See the squeezestart event for example code.

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}