WebVR Polyfill Device Parameter Database

1.0.18 · abandoned · verified Wed Apr 22

webvr-polyfill-dpdb is a JSON dataset containing device parameters crucial for the webvr-polyfill. It provides information like screen DPI, bezel width, and device identification rules (User-Agent, resolution, etc.) for various Android and iOS devices. This data is essential for the webvr-polyfill to accurately render stereoscopic scenes by correcting lens distortion on mobile devices, bridging the gap where web applications lack direct access to physical device characteristics. The package is currently at version 1.0.18, with its last recorded update in December 2020. Given that the underlying WebVR API has been deprecated in favor of WebXR, this database is largely superseded and serves a legacy purpose.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to import the `dpdb.json` data and programmatically access device parameters. This package primarily provides data, not executable functions.

import dpdb from 'webvr-polyfill-dpdb/dpdb.json';

// In a real application, you would pass this data to the webvr-polyfill
// for its configuration. This example demonstrates accessing the data directly.

console.log('Total devices in DPDB:', dpdb.devices.length);

// Find a specific device entry, for example, based on a User-Agent rule
const searchUA = 'ASUS_Z00AD';
const asusDevice = dpdb.devices.find(device =>
  device.rules.some(rule => rule.ua && rule.ua.includes(searchUA))
);

if (asusDevice) {
  console.log(`Found device: ASUS_Z00AD with DPI ${asusDevice.dpi} and bezel width ${asusDevice.bw}mm.`);
} else {
  console.log(`Device with UA '${searchUA}' not found in DPDB.`);
}

// Example of accessing a device from the raw formatted JSON (if available/desired)
// This would typically involve a separate build step or direct file access for customization
/*
fetch('node_modules/webvr-polyfill-dpdb/dpdb-formatted.json')
  .then(response => response.json())
  .then(formattedData => {
    console.log('Example from formatted DPDB:', formattedData.devices[0]);
  });
*/

view raw JSON →