Skip to content
This repository has been archived by the owner on May 25, 2020. It is now read-only.

LucidWebBVBA/retro-webxr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@lucidweb/retro-webxr

Why?

It is not always possible to upgrade to the latest version without breaking changes. Handling breaking changes requires time and careful planning. This package aims to maintain a certain level of compatibility for past projects using previous versions of A-Frame.

What?

This package is bundled as an UMD bundle and expose one function, useRetroWebXR which takes an Object toggling compatibility flags.

Semantic versioning is used to make sure nothing breaks if there is a module API change.

Current flags

  • browser.requestDevice: Alias navigator.xr.requestDevice to navigator.xr.requestSession. Only for Chrome 79+
  • aframe.assetItemGLBAsArrayBuffer: Set response-type="arraybuffer" on a-asset-item when their src ends with .glb

How?

Install

npm install --save @lucidweb/retro-webxr

Use

CJS

const { useRetroWebXR } = require('@lucidweb/retro-webxr');

useRetroWebXR({
    browser: {
        requestDevice: true
    },
    aframe: {
        assetItemGLBAsArrayBuffer: true
    }
});

ES2015

import { useRetroWebXR } from '@lucidweb/retro-webxr';

useRetroWebXR({
    browser: {
        requestDevice: true
    },
    aframe: {
        assetItemGLBAsArrayBuffer: true
    }
});

window.RetroWebXR

<script type="text/javascript" src="https://unpkg.com/@lucidweb/retro-webxr@^2/dist/index.js"></script>
window.RetroWebXR.useRetroWebXR({
    browser: {
        requestDevice: true
    },
    aframe: {
        assetItemGLBAsArrayBuffer: true
    }
});

About

A small layer to maintain backward compatibility of old projects in case of WebVR/WebXR API changes. /!\ This fiddles inside `window`.

Resources

Stars

Watchers

Forks

Packages

No packages published