Socket
Socket
Sign inDemoInstall

@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


Version published
Weekly downloads
483K
decreased by-15.74%
Maintainers
1
Weekly downloads
 
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