Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

is-webgl-context

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-webgl-context - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

27

index.js

@@ -1,10 +0,17 @@

module.exports = function(ctx) {
if (!ctx) return false
var gl = ctx
//compatibility with Chrome WebGL Inspector Addon
if (typeof ctx.rawgl !== 'undefined')
gl = ctx.rawgl
if (typeof WebGLRenderingContext !== 'undefined' && gl instanceof WebGLRenderingContext)
return true
return false
}
/*globals WebGL2RenderingContext,WebGLRenderingContext*/
module.exports = function isWebGLContext (ctx) {
if (!ctx) return false
var gl = ctx
// compatibility with Chrome WebGL Inspector Addon
if (typeof ctx.rawgl !== 'undefined') {
gl = ctx.rawgl
}
if ((typeof WebGLRenderingContext !== 'undefined'
&& gl instanceof WebGLRenderingContext) ||
(typeof WebGL2RenderingContext !== 'undefined'
&& gl instanceof WebGL2RenderingContext)) {
return true
}
return false
}
{
"name": "is-webgl-context",
"version": "1.0.0",
"version": "1.1.0",
"description": "whether the given object is a WebGL context",

@@ -14,2 +14,6 @@ "main": "index.js",

"devDependencies": {
"browserify": "^8.1.0",
"faucet": "0.0.1",
"smokestack": "^3.1.0",
"tap-closer": "^1.0.0",
"tape": "^3.0.0",

@@ -19,3 +23,3 @@ "webgl-context": "^1.2.1"

"scripts": {
"test": "node test.js"
"test": "browserify test.js | tap-closer | smokestack | tap-spec "
},

@@ -22,0 +26,0 @@ "keywords": [

@@ -5,4 +5,6 @@ # is-webgl-context

Test whether the given object is a WebGL context. This is useful to handle edge-cases, such as when [Chrome WebGL Inspector](https://chrome.google.com/webstore/detail/webgl-inspector/ogkcjmbhnfmlnielkjhedpcjomeaghda?hl=en) wraps WebGLRenderingContext in a different type.
Test whether the given object is a WebGL or WebGL2 context. This is useful to handle edge-cases, such as when [Chrome WebGL Inspector](https://chrome.google.com/webstore/detail/webgl-inspector/ogkcjmbhnfmlnielkjhedpcjomeaghda?hl=en) wraps WebGLRenderingContext in a different type.
Runs in Node and the browser.
```js

@@ -20,3 +22,3 @@ var isGL = require('is-webgl-context')

Returns true if the object is an instance of WebGLRenderingContext, handling edge cases for WebGL debuggers/inspectors.
Returns true if the object is an instance of WebGL[2]RenderingContext, handling edge cases for WebGL debuggers/inspectors.

@@ -23,0 +25,0 @@ ## License

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc