Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/webxr

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/webxr

TypeScript definitions for webxr

  • 0.5.20
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @types/webxr?

@types/webxr provides TypeScript definitions for the WebXR Device API, which allows developers to create immersive virtual reality (VR) and augmented reality (AR) experiences on the web. This package helps in ensuring type safety and better development experience when working with WebXR in TypeScript.

What are @types/webxr's main functionalities?

Session Management

This feature allows you to request and manage XR sessions. The code sample demonstrates how to request an immersive VR session with optional features.

const sessionInit = { optionalFeatures: ['local-floor', 'bounded-floor'] };
navigator.xr.requestSession('immersive-vr', sessionInit).then((session) => {
  console.log('Session started');
});

Reference Spaces

This feature allows you to create and manage reference spaces, which are coordinate systems used to track the position and orientation of the XR device. The code sample shows how to request a local reference space.

session.requestReferenceSpace('local').then((referenceSpace) => {
  console.log('Reference space created');
});

XRFrame Handling

This feature allows you to handle XR frames and get the viewer's pose. The code sample demonstrates how to request an animation frame and retrieve the viewer's pose.

session.requestAnimationFrame((time, frame) => {
  const pose = frame.getViewerPose(referenceSpace);
  if (pose) {
    console.log('Viewer pose:', pose);
  }
});

Other packages similar to @types/webxr

FAQs

Package last updated on 27 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc