@wixc3/isomorphic-worker
Advanced tools
Comparing version 1.2.4 to 1.2.5
/// <reference types="node" /> | ||
import { type MessagePort } from 'worker_threads'; | ||
import { type MessagePort } from 'node:worker_threads'; | ||
import type { MessageType, UniversalMessage, UniversalWorkerUserMethods } from './types'; | ||
@@ -4,0 +4,0 @@ declare class UniversalWorkerUser implements UniversalWorkerUserMethods { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.worker = void 0; | ||
const worker_threads_1 = require("worker_threads"); | ||
const node_worker_threads_1 = require("node:worker_threads"); | ||
const port = (function getPort() { | ||
if (!worker_threads_1.parentPort) { | ||
if (!node_worker_threads_1.parentPort) { | ||
throw new Error('parentPort required for worker processors'); | ||
} | ||
return worker_threads_1.parentPort; | ||
return node_worker_threads_1.parentPort; | ||
})(); | ||
@@ -15,3 +15,3 @@ class UniversalWorkerUser { | ||
this.messageHandlersMap = new Map(); | ||
this.workerData = worker_threads_1.workerData; | ||
this.workerData = node_worker_threads_1.workerData; | ||
} | ||
@@ -18,0 +18,0 @@ postMessage(message) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Worker = void 0; | ||
const worker_threads_1 = require("worker_threads"); | ||
const node_worker_threads_1 = require("node:worker_threads"); | ||
class NodeWorker { | ||
constructor(url, options) { | ||
this.messageHandlersMap = new Map(); | ||
this.worker = new worker_threads_1.Worker(url, options); | ||
this.worker = new node_worker_threads_1.Worker(url, options); | ||
} | ||
@@ -10,0 +10,0 @@ postMessage(message) { |
{ | ||
"name": "@wixc3/isomorphic-worker", | ||
"version": "1.2.4", | ||
"version": "1.2.5", | ||
"description": "simplified cross worker API for web workers and worker threads", | ||
@@ -13,11 +13,11 @@ "homepage": "https://github.com/wixplosives/isomorphic-worker", | ||
"browser": "./dist/browser-worker-scope.js", | ||
"require": "./dist/node-worker-scope.js", | ||
"node": "./dist/node-worker-scope.js", | ||
"types": "./dist/node-worker-scope.d.ts", | ||
"default": "./dist/browser-worker-scope.js" | ||
"default": "./dist/node-worker-scope.js" | ||
}, | ||
"./worker": { | ||
"browser": "./dist/browser-worker.js", | ||
"require": "./dist/node-worker.js", | ||
"node": "./dist/node-worker.js", | ||
"types": "./dist/node-worker.d.ts", | ||
"default": "./dist/browser-worker.js" | ||
"default": "./dist/node-worker.js" | ||
}, | ||
@@ -24,0 +24,0 @@ "./types": { |
@@ -1,2 +0,2 @@ | ||
import { parentPort, workerData, type MessagePort } from 'worker_threads'; | ||
import { parentPort, workerData, type MessagePort } from 'node:worker_threads'; | ||
import type { | ||
@@ -3,0 +3,0 @@ MessageType, |
@@ -1,2 +0,2 @@ | ||
import { Worker } from 'worker_threads'; | ||
import { Worker } from 'node:worker_threads'; | ||
import type { | ||
@@ -3,0 +3,0 @@ MessageType, |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38965