detect-features
Version:
Detect and report browser and hardware features.
16 lines (13 loc) • 366 B
JavaScript
// @ts-check
/**
* Tests for WebGL support
*
* @returns {boolean}
*/
export default (() => {
const canvas = document.createElement('canvas');
const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
/* eslint-disable no-undef */
return (gl && gl instanceof WebGLRenderingContext) || false;
/* eslint-enable no-undef */
})();