From f103773ff5f8cc38ea94dc82d98ebc6cacb51885 Mon Sep 17 00:00:00 2001 From: Marcel Wiessler Date: Wed, 6 Mar 2024 21:47:18 +0800 Subject: [PATCH] add docs for global XR start events --- documentation/scripting.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/documentation/scripting.md b/documentation/scripting.md index 72d9a8755..7402fa821 100644 --- a/documentation/scripting.md +++ b/documentation/scripting.md @@ -162,6 +162,15 @@ Note that lifecycle methods are only being called when they are declared. So onl | `onControllerAdded(args: NeedleXRControllerEventArgs)` | Callback when a controller is connected/added while in a XR session OR when the component joins a running XR session that has already connected controllers OR when the component becomes active during a running XR session that has already connected controllers | `onControllerRemoved(args: NeedleXRControllerEventArgs)` | callback when a controller is removed while in a XR session OR when the component becomes inactive during a running XR session +#### Additional XR events + +| Method name | Description | +| -- | -- +| `window.addEventListener("needle-xrsession-start")` | CustomEvent that is invoked when a XRSession starts. `details` contains the `NeedleXRSession` +| `window.addEventListener("needle-xrsession-end")` | CustomEvent that is invoked when a XRSession starts. `details` contains the `NeedleXRSession` +| `onXRSessionStart(args: { session:NeedleXRSession } )` | global event hook. To unsubscribe use `offXRSessionStart` + + ### Coroutines Coroutines can be declared using the [JavaScript Generator Syntax](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator).