Detect if WebGL is enabled in the current environment.
npm install is-webgl-enabled
var isWebGLEnabled =if// WebGL is enabled! :)else// WebGL is not enabled! :(
I saw a few different implementations on npm, but they were either poorly documented, exported a value instead of a function, or returned an inconsitent type (such as true or null). So I made one for myself that just works™.
Also this became extra useful when my GPU got blacklisted by chromium.
Contributions welcome! Please read the contributing guidelines first.