@needle-tools/engine
Version:
Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.
67 lines (66 loc) • 2.19 kB
TypeScript
import type { NeedleXRSession } from "./NeedleXRSession.js";
export declare type XRSessionEventArgs = {
session: NeedleXRSession;
};
/**
* Add a listener for when an XR session starts
* This event is triggered when the XR session is started, either by the user or by the application before all other XR start events
* @param fn The function to call when the XR session starts
* @example
* ```js
* onXRSessionStart((evt) => {
* console.log("XR session started", evt);
* });
* ```
*/
export declare function onXRSessionStart(fn: (evt: XRSessionEventArgs) => void): void;
/**
* Remove a listener for when an XR session starts
* @param fn The function to remove from the listeners
* @example
* ```js
* const myFunction = (evt) => {
* console.log("XR session started", evt);
* };
* onXRSessionStart(myFunction);
* offXRSessionStart(myFunction);
* ```
*/
export declare function offXRSessionStart(fn: (evt: XRSessionEventArgs) => void): void;
/**
* Add a listener for when an XR session ends
* This event is triggered when the XR session is ended, either by the user or by the application before all other XR end events
* @param fn The function to call when the XR session ends
* @example
* ```js
* onXRSessionEnd((evt) => {
* console.log("XR session ended", evt);
* });
* ```
*/
export declare function onXRSessionEnd(fn: (evt: XRSessionEventArgs) => void): void;
/**
* Remove a listener for when an XR session ends
* @param fn The function to remove from the listeners
* @example
* ```js
* const myFunction = (evt) => {
* console.log("XR session ended", evt);
* };
* onXRSessionEnd(myFunction);
* offXRSessionEnd(myFunction);
* ```
*/
export declare function offXRSessionEnd(fn: (evt: XRSessionEventArgs) => void): void;
/**
* @internal
* Invoke the XRSessionStart event
* @param evt The XRSession event arguments
*/
export declare function invokeXRSessionStart(evt: XRSessionEventArgs): void;
/**
* @internal
* Invoke the XRSessionEnd event
* @param evt The XRSession event arguments
*/
export declare function invokeXRSessionEnd(evt: XRSessionEventArgs): void;