UNPKG

@threlte/xr

Version:

Tools to more easily create VR and AR experiences with Threlte

18 lines (17 loc) 500 B
import { session } from './state.svelte.js'; import { raf } from './raf.js'; export const setupRaf = () => { if (typeof window === 'undefined') return; $effect.pre(() => { const currentSession = session.current; if (currentSession === undefined) { return; } const originalTick = raf.tick; raf.tick = (fn) => currentSession.requestAnimationFrame(fn); return () => { raf.tick = originalTick; }; }); };