包详细信息

is-webgl-enabled

ungoldman1.2kISC1.0.2

Detect if WebGL is enabled in the current environment.

detect, disabled, enabled, webgl

自述文件

is-webgl-enabled

Detect if WebGL is enabled in the current environment.

npm travis standard

Install

npm install is-webgl-enabled

Usage

var isWebGLEnabled = require('is-webgl-enabled')

if (isWebGLEnabled()) {
  // WebGL is enabled! :)
} else {
  // WebGL is not enabled! :(
}

Why

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.

Contributing

Contributions welcome! Please read the contributing guidelines first.

License

ISC

更新日志

is-webgl-enabled change log

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

1.0.2

  • remove unnecessary global module from usage example

1.0.1

  • use global/document and global/window to support non-browser environments
  • fix typo in example
  • add browser test

1.0.0

  • init