# `Events['xr:end']`

> Contract 2.0.0 · package sha256 `a857eca95b35921109faf997094bb4192f12527d9d0fcd4be7e97f06425bad6e` · generated from `configurator-runtime.d.ts` by `services/onsite-scripter/scripts/build-contract-docs.mjs`; edit the source, not this file.

Property of [`Events`](Events.md) · labs, `@experimental` · since 2.0.0

```ts
'xr:end': {
  readonly reason: 'user' | 'error' | 'background' | 'destroy' | 'fallback' | 'other';
  readonly durationMs: number;
};
```

That XR session ended, `durationMs` after the tap: 'user' (the shopper closed it), 'error',
'background' (the page was hidden), 'destroy', 'fallback' (the shopper went on to the native
AR viewer or the 3D view), 'other' ([`endAR()`](Session.endAR.md), an aborted call).

## Fields

<a id="reason"></a>
### `reason`

```ts
readonly reason: 'user' | 'error' | 'background' | 'destroy' | 'fallback' | 'other';
```

<a id="durationms"></a>
### `durationMs`

```ts
readonly durationMs: number;
```

## Generic-API test (spec 3.1)

| Rule | Result |
| --- | --- |
| 1. Neutral name | pass: `xr:end` names no product |
| 2. A precedent | pass: [model-viewer canActivateAR and activateAR()](https://modelviewer.dev/docs/index.html#entrydocs-augmentedreality-methods-activateAR) (row `G66`); [XRSession.end()](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/end) (row `G66`); [Navigator.share() (resolves when the share UI closes)](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/share) (row `G66`) |
| 3. Two apps, or labs | labs (`@experimental` at a stable path, reached through `has()` or `supports()`): it graduates when a second app uses it; apps today: configurator-template, tryon-template |
| 4. The cheaper fix first | decided per need in Appendix B: rows `G66` at tier labs (a member only where no rule, data, asset or app code serves the need) |
