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

image-filter-core

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

image-filter-core - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

2

package.json
{
"name": "image-filter-core",
"version": "2.0.0",
"version": "2.0.1",
"description": "Core module for image-filter",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -53,7 +53,7 @@ require('es6-promise/auto');

*/
function createWorker() {
function createWorkerURL() {
var functionBody = extractBodyFunction(worker);
var blob = new Blob([functionBody], { type: 'text/javascript' });
return new Worker(window.URL.createObjectURL(blob));
return window.URL.createObjectURL(blob);
}

@@ -84,5 +84,4 @@

function apply(data, transform, options, nWorkers) {
var w = createWorker();
var transformationURL = createTransformation(transform);
var workerURL = createWorkerURL();
var canvas = getCanvas(data.width, data.height);

@@ -108,2 +107,3 @@ var context = canvas.getContext('2d');

for (var index = 0; index < nWorkers; index++) {
var w = new Worker(workerURL);

@@ -113,3 +113,2 @@ w.addEventListener('message', function (e) {

var resultCanvasData = e.data.result;
var index = e.data.index;

@@ -119,3 +118,3 @@ // Copying back canvas data to canvas

// If the second webworker (index 1) returns data, apply it at pixel (0, canvas.height/4) onwards, and so on
context.putImageData(resultCanvasData, 0, blockSize * index);
context.putImageData(resultCanvasData, 0, blockSize * e.data.index);

@@ -122,0 +121,0 @@ finished++;

@@ -90,4 +90,4 @@ const expect = require('chai').expect;

// Two object urls created, one for the worker one for the transform function
expect(window.URL.createObjectURL.calledTwice).to.equal(true);
expect(window.Worker.calledOnce).to.equal(true);
expect(window.URL.createObjectURL.callCount).to.equal(2);
expect(window.Worker.callCount).to.equal(4);

@@ -94,0 +94,0 @@ const evt = { data: { result: 'DUMMY', index: 1 } };

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