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

worktank

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

worktank - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

2

dist/worker/backend_compiled.d.ts

@@ -1,2 +0,2 @@

declare const _default: "var o=class{constructor(){this.methods={};addEventListener(\"message\",this.message.bind(this))}exec(t,e){let n=this.methods[t],a=new Promise(s=>s(n.apply(void 0,e))),c=s=>{try{postMessage({type:\"result\",value:s})}catch(i){r(i)}},r=s=>{s=s instanceof Error?s:typeof s==\"string\"?new Error(s):new Error;let{message:i,name:d,stack:g}=s;postMessage({type:\"result\",error:{message:i,name:d,stack:g}})};a.then(c,r)}init(t){this.register(t),postMessage({type:\"ready\"})}message(t){if(t.data.type===\"init\")return this.init(t.data.methods);if(t.data.type===\"exec\")return this.exec(t.data.method,t.data.args)}register(t){if(typeof t==\"string\"){let e=new Function(t)();for(let n in e)this.methods[n]=e[n]}else for(let e in t){let n=new Function(`return (${t[e]})`)();this.methods[e]=n}}};new o;";
declare const _default: "var u=new Function(\"url\",\"return import ( url );\"),a=u;var i=class{constructor(){this.methods={};addEventListener(\"message\",this.message.bind(this))}exec(t,s){let n=this.methods[t],c=new Promise(e=>e(n.apply({import:a},s))),d=e=>{try{postMessage({type:\"result\",value:e})}catch(o){r(o)}},r=e=>{e=e instanceof Error?e:typeof e==\"string\"?new Error(e):new Error;let{message:o,name:p,stack:g}=e;postMessage({type:\"result\",error:{message:o,name:p,stack:g}})};c.then(d,r)}init(t){this.register(t),postMessage({type:\"ready\"})}message(t){if(t.data.type===\"init\")return this.init(t.data.methods);if(t.data.type===\"exec\")return this.exec(t.data.method,t.data.args)}register(t){if(typeof t==\"string\"){let s=new Function(t)();for(let n in s)this.methods[n]=s[n]}else for(let s in t){let n=new Function(`return (${t[s]})`)();this.methods[s]=n}}};new i;";
export default _default;

@@ -1,1 +0,1 @@

export default 'var o=class{constructor(){this.methods={};addEventListener("message",this.message.bind(this))}exec(t,e){let n=this.methods[t],a=new Promise(s=>s(n.apply(void 0,e))),c=s=>{try{postMessage({type:"result",value:s})}catch(i){r(i)}},r=s=>{s=s instanceof Error?s:typeof s=="string"?new Error(s):new Error;let{message:i,name:d,stack:g}=s;postMessage({type:"result",error:{message:i,name:d,stack:g}})};a.then(c,r)}init(t){this.register(t),postMessage({type:"ready"})}message(t){if(t.data.type==="init")return this.init(t.data.methods);if(t.data.type==="exec")return this.exec(t.data.method,t.data.args)}register(t){if(typeof t=="string"){let e=new Function(t)();for(let n in e)this.methods[n]=e[n]}else for(let e in t){let n=new Function(`return (${t[e]})`)();this.methods[e]=n}}};new o;';
export default 'var u=new Function("url","return import ( url );"),a=u;var i=class{constructor(){this.methods={};addEventListener("message",this.message.bind(this))}exec(t,s){let n=this.methods[t],c=new Promise(e=>e(n.apply({import:a},s))),d=e=>{try{postMessage({type:"result",value:e})}catch(o){r(o)}},r=e=>{e=e instanceof Error?e:typeof e=="string"?new Error(e):new Error;let{message:o,name:p,stack:g}=e;postMessage({type:"result",error:{message:o,name:p,stack:g}})};c.then(d,r)}init(t){this.register(t),postMessage({type:"ready"})}message(t){if(t.data.type==="init")return this.init(t.data.methods);if(t.data.type==="exec")return this.exec(t.data.method,t.data.args)}register(t){if(typeof t=="string"){let s=new Function(t)();for(let n in s)this.methods[n]=s[n]}else for(let s in t){let n=new Function(`return (${t[s]})`)();this.methods[s]=n}}};new i;';
/* IMPORT */
import importFool from 'import-fool-webpack';
/* MAIN */

@@ -13,3 +14,3 @@ class WorkerBackend {

const fn = this.methods[method];
const result = new Promise(resolve => resolve(fn.apply(undefined, args)));
const result = new Promise(resolve => resolve(fn.apply({ import: importFool }, args)));
const onSuccess = (value) => {

@@ -57,2 +58,1 @@ try {

new WorkerBackend();
export {};

@@ -5,3 +5,3 @@ {

"description": "A simple isomorphic library for executing functions inside WebWorkers or Node Threads pools.",
"version": "2.0.0",
"version": "2.1.0",
"type": "module",

@@ -32,2 +32,3 @@ "main": "dist/index.js",

"dependencies": {
"import-fool-webpack": "^1.0.0",
"promise-make-naked": "^2.0.0",

@@ -34,0 +35,0 @@ "web-worker": "1.2.0"

@@ -40,3 +40,3 @@ # WorkTank

sum: function ( a: number, b: number ): Promise<number> {
const {default: math} = await import ( 'math' );
const {default: math} = await this.import ( 'math' ); // Use `this.import` rather than the regular `import` inside functions that need to load a dependency if you are using a bundler, or pre-bundle the functions that get sent to worker threads
return math.sum ( a + b );

@@ -43,0 +43,0 @@ },

@@ -1,1 +0,1 @@

export default 'var o=class{constructor(){this.methods={};addEventListener("message",this.message.bind(this))}exec(t,e){let n=this.methods[t],a=new Promise(s=>s(n.apply(void 0,e))),c=s=>{try{postMessage({type:"result",value:s})}catch(i){r(i)}},r=s=>{s=s instanceof Error?s:typeof s=="string"?new Error(s):new Error;let{message:i,name:d,stack:g}=s;postMessage({type:"result",error:{message:i,name:d,stack:g}})};a.then(c,r)}init(t){this.register(t),postMessage({type:"ready"})}message(t){if(t.data.type==="init")return this.init(t.data.methods);if(t.data.type==="exec")return this.exec(t.data.method,t.data.args)}register(t){if(typeof t=="string"){let e=new Function(t)();for(let n in e)this.methods[n]=e[n]}else for(let e in t){let n=new Function(`return (${t[e]})`)();this.methods[e]=n}}};new o;';
export default 'var u=new Function("url","return import ( url );"),a=u;var i=class{constructor(){this.methods={};addEventListener("message",this.message.bind(this))}exec(t,s){let n=this.methods[t],c=new Promise(e=>e(n.apply({import:a},s))),d=e=>{try{postMessage({type:"result",value:e})}catch(o){r(o)}},r=e=>{e=e instanceof Error?e:typeof e=="string"?new Error(e):new Error;let{message:o,name:p,stack:g}=e;postMessage({type:"result",error:{message:o,name:p,stack:g}})};c.then(d,r)}init(t){this.register(t),postMessage({type:"ready"})}message(t){if(t.data.type==="init")return this.init(t.data.methods);if(t.data.type==="exec")return this.exec(t.data.method,t.data.args)}register(t){if(typeof t=="string"){let s=new Function(t)();for(let n in s)this.methods[n]=s[n]}else for(let s in t){let n=new Function(`return (${t[s]})`)();this.methods[s]=n}}};new i;';
/* IMPORT */
import importFool from 'import-fool-webpack';
import type {Message} from '../types';

@@ -27,3 +28,3 @@

const fn = this.methods[method];
const result = new Promise ( resolve => resolve ( fn.apply ( undefined, args ) ) );
const result = new Promise ( resolve => resolve ( fn.apply ( { import: importFool }, args ) ) );

@@ -30,0 +31,0 @@ const onSuccess = ( value: any ): void => {

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