@thumbmarkjs/thumbmarkjs
Advanced tools
Comparing version 0.12.3 to 0.12.4
@@ -42,15 +42,15 @@ "use strict"; | ||
var commonPixels_1 = require("../../utils/commonPixels"); | ||
var canvas = document.createElement('canvas'); | ||
canvas.width = 200; | ||
canvas.height = 100; | ||
var gl = canvas.getContext('webgl'); | ||
function createWebGLFingerprint() { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var canvas, gl, imageDatas, commonImageData; | ||
var imageDatas, commonImageData; | ||
return __generator(this, function (_a) { | ||
try { | ||
canvas = document.createElement('canvas'); | ||
canvas.width = 200; | ||
canvas.height = 100; | ||
gl = canvas.getContext('webgl'); | ||
if (!gl) { | ||
throw new Error('WebGL not supported'); | ||
} | ||
imageDatas = Array.from({ length: 3 }, function () { return createWebGLImageData(); }); | ||
imageDatas = Array.from({ length: 1 }, function () { return createWebGLImageData(); }); | ||
commonImageData = (0, commonPixels_1.getCommonPixels)(imageDatas, canvas.width, canvas.height); | ||
@@ -76,8 +76,3 @@ //const imageData = createWebGLImageData() | ||
function createWebGLImageData() { | ||
var gl = null; | ||
try { | ||
var canvas = document.createElement('canvas'); | ||
canvas.width = 200; | ||
canvas.height = 100; | ||
gl = canvas.getContext('webgl'); | ||
if (!gl) { | ||
@@ -140,8 +135,2 @@ throw new Error('WebGL not supported'); | ||
var imageData = new ImageData(pixelData, canvas.width, canvas.height); | ||
// WebGL cleanup | ||
gl.disableVertexAttribArray(positionAttribute); | ||
gl.deleteBuffer(vertexBuffer); | ||
gl.deleteProgram(shaderProgram); | ||
gl.deleteShader(vertexShader); | ||
gl.deleteShader(fragmentShader); | ||
return imageData; | ||
@@ -155,6 +144,7 @@ } | ||
if (gl) { | ||
var loseContextExtension = gl.getExtension('WEBGL_lose_context'); | ||
if (loseContextExtension) { | ||
loseContextExtension.loseContext(); | ||
} | ||
// Reset WebGL state | ||
gl.bindBuffer(gl.ARRAY_BUFFER, null); | ||
gl.useProgram(null); | ||
gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); | ||
gl.clearColor(0.0, 0.0, 0.0, 0.0); | ||
} | ||
@@ -161,0 +151,0 @@ } |
{ | ||
"name": "@thumbmarkjs/thumbmarkjs", | ||
"version": "0.12.3", | ||
"version": "0.12.4", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
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
116362
1657