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

threads

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

threads - npm Package Compare versions

Comparing version 1.0.0-beta.7 to 1.0.0-beta.8

dist/master/get-bundle-url.browser.d.ts

17

dist/master/implementation.browser.js
"use strict";
// tslint:disable max-classes-per-file
Object.defineProperty(exports, "__esModule", { value: true });
const get_bundle_url_browser_1 = require("./get-bundle-url.browser");
const defaultPoolSize = navigator.hardwareConcurrency || 4;
const isAbsoluteURL = (value) => /^(https?:)?\/\//i.test(value);
const isAbsoluteURL = (value) => /^(file|https?:)?\/\//i.test(value);
function createSourceBlobURL(code) {

@@ -10,2 +12,11 @@ const blob = new Blob([code], { type: "application/javascript" });

function selectWorkerImplementation() {
if (typeof Worker === "undefined") {
// Might happen on Safari, for instance
// The idea is to only fail if the constructor is actually used
return class NoWebWorker {
constructor() {
throw Error("No web worker implementation available. You might have tried to spawn a worker within a worker in a browser that doesn't support workers in workers.");
}
};
}
return class WebWorker extends Worker {

@@ -16,2 +27,6 @@ constructor(url, options) {

}
else if (typeof url === "string" && !isAbsoluteURL(url) && get_bundle_url_browser_1.getBundleURL().match(/^file:\/\//i)) {
url = new URL(url, get_bundle_url_browser_1.getBundleURL().replace(/\/[^\/]+$/, "/"));
url = createSourceBlobURL(`importScripts(${JSON.stringify(url)});`);
}
if (typeof url === "string" && isAbsoluteURL(url)) {

@@ -18,0 +33,0 @@ // Create source code blob loading JS file via `importScripts()`

6

dist/worker/index.js

@@ -63,3 +63,3 @@ "use strict";

const { payload, transferables } = deconstructTransfer(resultValue);
const startMessage = {
const resultMessage = {
type: messages_1.WorkerMessageType.result,

@@ -70,3 +70,3 @@ uid,

};
implementation_1.default.postMessageToMaster(startMessage, transferables);
implementation_1.default.postMessageToMaster(resultMessage, transferables);
}

@@ -153,3 +153,3 @@ function postJobStartMessage(uid, resultType) {

// Post with some delay, so the master had some time to subscribe to messages
setTimeout(() => postUncaughtErrorMessage(event.error), 250);
setTimeout(() => postUncaughtErrorMessage(event.error || event), 250);
});

@@ -156,0 +156,0 @@ self.addEventListener("unhandledrejection", event => {

{
"name": "threads",
"version": "1.0.0-beta.7",
"version": "1.0.0-beta.8",
"description": "Easy to use, yet powerful multi-threading library for node.js, web browsers and Electron",

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

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