Comparing version 0.0.0 to 1.0.0
{ | ||
"name": "webglew", | ||
"version": "0.0.0", | ||
"version": "1.0.0", | ||
"description": "WebGL extension wrangler", | ||
@@ -26,3 +26,6 @@ "main": "webglew.js", | ||
"readmeFilename": "README.md", | ||
"gitHead": "c561ef237cb3b66576b0e9e599f729628a209649" | ||
"gitHead": "c561ef237cb3b66576b0e9e599f729628a209649", | ||
"dependencies": { | ||
"weakmap": "0.0.6" | ||
} | ||
} |
webglew | ||
======= | ||
*WebGL* *E*xtension *W*rangler. Manages WebGL extensions so you don't have to. | ||
**WebGL** **E** xtension **W** rangler. Manages WebGL extensions so you don't have to. | ||
@@ -5,0 +5,0 @@ Usage |
"use strict"; | ||
var VENDOR_PREFIX = [ | ||
"WEBKIT_", | ||
"MOZ_" | ||
]; | ||
var WeakMap = WeakMap || require("weakmap") | ||
var WebGLEWStruct = new WeakMap() | ||
function baseName(ext_name) { | ||
for(var i=0; i<VENDOR_PREFIX.length; ++i) { | ||
var prefix = VENDOR_PREFIX[i]; | ||
if(ext_name.indexOf(prefix) === 0) { | ||
return ext_name.slice(prefix.length); | ||
} | ||
} | ||
return ext_name; | ||
return ext_name.replace(/^[A-Z]+_/, "") | ||
} | ||
function initWebGLEW(gl) { | ||
if(gl._webglew_struct) { | ||
return gl._webglew_struct; | ||
var struct = WebGLEWStruct.get(gl) | ||
if(struct) { | ||
return struct | ||
} | ||
var extensions = {}; | ||
var supported = gl.getSupportedExtensions(); | ||
var extensions = {} | ||
var supported = gl.getSupportedExtensions() | ||
for(var i=0; i<supported.length; ++i) { | ||
var ext = gl.getExtension(supported[i]); | ||
var extName = supported[i] | ||
var ext = gl.getExtension(supported[i]) | ||
if(!ext) { | ||
continue; | ||
continue | ||
} | ||
extensions[supported[i]] = ext; | ||
extensions[baseName(supported[i])] = ext; //Add version without VENDOR | ||
while(true) { | ||
extensions[extName] = ext | ||
var base = baseName(extName) | ||
if(base === extName) { | ||
break | ||
} | ||
extName = base | ||
} | ||
} | ||
gl._webglew_struct = extensions; | ||
return extensions; | ||
WebGLEWStruct.set(gl, extensions) | ||
return extensions | ||
} | ||
module.exports = initWebGLEW; | ||
module.exports = initWebGLEW |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2320
1
1
+ Addedweakmap@0.0.6
+ Addedweakmap@0.0.6(transitive)