immersive-web / webxr-polyfill

Use the WebXR Device API today, providing fallbacks to native WebVR 1.1 and Cardboard
Apache License 2.0
381 stars 84 forks source link

XRInputSourceArray #112

Open lojjic opened 4 years ago

lojjic commented 4 years ago

The spec defines session.inputSources as a XRInputSourceArray, a stripped-down arraylike interface. The polyfill currently exposes it as a regular JS array instead.

I ran into this when trying out Chrome beta's native implementation, where my polyfill-backed code was happily doing inputSources.map(...) which suddenly broke. The polyfill should implement the XRInputSourceArray interface and expose that instead.

I have a work in progress for this here - I welcome any suggestions or concerns with that approach before I work it up into a PR: https://github.com/lojjic/webxr-polyfill/tree/XRInputSourceArray