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

@wixc3/isomorphic-worker

Package Overview
Dependencies
Maintainers
65
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wixc3/isomorphic-worker - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

4

dist/browser-worker.d.ts

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

import type { UniversalWorker } from './types';
export declare const Worker: new (url: string | URL, options: WorkerOptions) => UniversalWorker;
import type { UniversalWorker, WorkerScript } from './types';
export declare const Worker: new (url: WorkerScript, options: WorkerOptions) => UniversalWorker;
//# sourceMappingURL=browser-worker.d.ts.map

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

import type { MessageType, UniversalMessage, UniversalWorker, UniversalWorkerOptions } from './types';
import type { MessageType, UniversalMessage, UniversalWorker, UniversalWorkerOptions, WorkerScript } from './types';
declare class NodeWorker implements UniversalWorker {
private worker;
constructor(workerScript: string | URL, options?: UniversalWorkerOptions);
constructor(url: WorkerScript, _options?: UniversalWorkerOptions);
postMessage(message: any): void;
addEventListener(type: MessageType, callback: (message: UniversalMessage) => void): void;
terminate(): void;
terminate(): Promise<number>;
}
export { NodeWorker as Worker };
//# sourceMappingURL=node-worker.d.ts.map

@@ -6,4 +6,4 @@ "use strict";

var NodeWorker = /** @class */ (function () {
function NodeWorker(workerScript, options) {
this.worker = new worker_threads_1.Worker(workerScript);
function NodeWorker(url, _options) {
this.worker = new worker_threads_1.Worker(url);
}

@@ -17,3 +17,3 @@ NodeWorker.prototype.postMessage = function (message) {

NodeWorker.prototype.terminate = function () {
this.worker.terminate();
return this.worker.terminate();
};

@@ -20,0 +20,0 @@ return NodeWorker;

export type MessageType = 'message' | 'error';
export type WorkerScript = string | URL;
export interface UniversalWorkerOptions {

@@ -3,0 +4,0 @@ type?: 'classic' | 'module';

{
"name": "@wixc3/isomorphic-worker",
"version": "1.0.4",
"version": "1.0.5",
"description": "simplified cross worker API for web workers and worker threads",

@@ -48,17 +48,3 @@ "homepage": "https://github.com/wixplosives/isomorphic-worker",

"url": "git+https://github.com/wixplosives/isomorphic-worker.git"
},
"devDependencies": {
"@types/chai": "^4.3.4",
"@types/mocha": "^10.0.1",
"@types/node": "18",
"@wixc3/create-disposables": "^2.2.0",
"chai": "^4.3.7",
"mocha": "^10.2.0",
"mocha-play": "^4.1.0",
"rimraf": "^3.0.2",
"source-map-loader": "^4.0.1",
"typescript": "^4.9.4",
"webpack": "^5.75.0",
"worker-plugin": "^5.0.1"
}
}

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

import type { UniversalWorker } from './types';
import type { UniversalWorker, WorkerScript } from './types';
// globalThis in case of initial worker script inside a worker
export const Worker = globalThis.Worker as {
new (url: string | URL, options: WorkerOptions): UniversalWorker;
new (url: WorkerScript, options: WorkerOptions): UniversalWorker;
};

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

import { Worker, WorkerOptions } from 'worker_threads';
import type { MessageType, UniversalMessage, UniversalWorker, UniversalWorkerOptions } from './types';
import { Worker } from 'worker_threads';
import type { MessageType, UniversalMessage, UniversalWorker, UniversalWorkerOptions, WorkerScript } from './types';

@@ -7,4 +7,4 @@ class NodeWorker implements UniversalWorker {

constructor(workerScript: string | URL, options?: UniversalWorkerOptions) {
this.worker = new Worker(workerScript);
constructor(url: WorkerScript, _options?: UniversalWorkerOptions) {
this.worker = new Worker(url);
}

@@ -21,3 +21,3 @@

public terminate() {
this.worker.terminate();
return this.worker.terminate();
}

@@ -24,0 +24,0 @@ }

export type MessageType = 'message' | 'error';
export type WorkerScript = string | URL;
export interface UniversalWorkerOptions {

@@ -4,0 +6,0 @@ type?: 'classic' | 'module';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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