Socket
Socket
Sign inDemoInstall

workerboxjs

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

workerboxjs - npm Package Compare versions

Comparing version 5.2.0 to 5.3.0

18

lib/index.js

@@ -43,3 +43,3 @@ import createCallbackStore from './createCallbackStore.js';

if (options.appendVersion) {
scriptUrl = scriptUrl + '/v5.2.0/';
scriptUrl = scriptUrl + '/v5.3.0/';
}

@@ -62,8 +62,10 @@

const run = (id, args) =>
new Promise(resolve => {
instance.postMessage(['callback', { id, args, resolve: callbacks.add(resolve) }]);
new Promise((resolve, reject) => {
instance.postMessage(['callback', {
id, args, resolve: callbacks.add(resolve), reject: callbacks.add(reject)
}]);
});
const instance = await createWorkerboxInstance(scriptUrl.href, async message => {
const [action, { id, args, resolve }] = message.data;
const [action, { id, args, resolve, reject }] = message.data;

@@ -87,4 +89,8 @@ const parsedArgs = stringToArgs(args, callbacks.add, run);

const result = await fn(...parsedArgs);
instance.postMessage(['callback', { id: resolve, args: argsToString([result], callbacks.add, run) }]);
try {
const result = await fn(...parsedArgs);
instance.postMessage(['callback', { id: resolve, args: argsToString([result], callbacks.add, run) }]);
} catch (error) {
instance.postMessage(['callback', { id: reject, args: argsToString([error.message], callbacks.add, run) }]);
}
});

@@ -91,0 +97,0 @@

{
"name": "workerboxjs",
"version": "5.2.0",
"version": "5.3.0",
"type": "module",

@@ -5,0 +5,0 @@ "description": "A secure sandbox to execute untrusted user JavaScript, in a web browser, without any risk to your own domain/site/page.",

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