@threlte/xr 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,7 +18,7 @@ This should be placed within a Threlte `<Canvas />`.
18
18
 
19
19
  -->
20
20
  <script lang="ts">
21
- import { onMount, type Snippet } from 'svelte'
21
+ import { onDestroy, onMount, type Snippet } from 'svelte'
22
22
  import { useThrelte, watch } from '@threlte/core'
23
23
  import type { XRSessionEvent } from '../types'
24
24
  import {
@@ -168,6 +168,12 @@ This should be placed within a Threlte `<Canvas />`.
168
168
  xr.removeEventListener('sessionend', handleSessionEnd)
169
169
  }
170
170
  })
171
+ onDestroy(() => {
172
+ // if unmounted while presenting (e.g. due to sveltekit navigation), end the session
173
+ if (session.current) {
174
+ session.current.end()
175
+ }
176
+ })
171
177
 
172
178
  $effect.pre(() => updateTargetFrameRate(frameRate))
173
179
  $effect.pre(() => xr.setFoveation(foveation))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threlte/xr",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "author": "Micheal Parks <michealparks1989@gmail.com> (https://parks.lol)",
5
5
  "license": "MIT",
6
6
  "description": "Tools to more easily create VR and AR experiences with Threlte",