web-worker-helper
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -0,1 +1,2 @@ | ||
export declare const version = "0.0.2"; | ||
import type { WorkerObject } from './types'; | ||
@@ -2,0 +3,0 @@ export type { WorkerObject, WorkerOptions, WorkerMessage, WorkerMessageType, WorkerMessageData, WorkerMessagePayload, } from './types'; |
@@ -0,1 +1,2 @@ | ||
export var version = '0.0.2'; | ||
// GENERAL UTILS | ||
@@ -25,6 +26,4 @@ export { assert } from './utils/env-utils/assert'; | ||
name: 'null', | ||
module: 'worker-utils', | ||
options: { | ||
null: {}, | ||
}, | ||
module: 'web-worker-helper', | ||
options: {}, | ||
}; |
@@ -0,1 +1,2 @@ | ||
export declare const version = "0.0.2"; | ||
import type { WorkerObject } from './types'; | ||
@@ -2,0 +3,0 @@ export type { WorkerObject, WorkerOptions, WorkerMessage, WorkerMessageType, WorkerMessageData, WorkerMessagePayload, } from './types'; |
@@ -6,3 +6,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.NullWorker = exports.AsyncQueue = exports.loadLibrary = exports.getLibraryUrl = exports.getTransferList = exports.getWorkerURL = exports.createWorker = exports.canProcessOnWorker = exports.processOnWorker = exports.WorkerBody = exports.WorkerPool = exports.WorkerFarm = exports.WorkerThread = exports.WorkerJob = exports.isWorker = exports.assert = void 0; | ||
exports.NullWorker = exports.AsyncQueue = exports.loadLibrary = exports.getLibraryUrl = exports.getTransferList = exports.getWorkerURL = exports.createWorker = exports.canProcessOnWorker = exports.processOnWorker = exports.WorkerBody = exports.WorkerPool = exports.WorkerFarm = exports.WorkerThread = exports.WorkerJob = exports.isWorker = exports.assert = exports.version = void 0; | ||
exports.version = '0.0.2'; | ||
// GENERAL UTILS | ||
@@ -47,6 +48,4 @@ var assert_1 = require("./utils/env-utils/assert"); | ||
name: 'null', | ||
module: 'worker-utils', | ||
options: { | ||
null: {}, | ||
}, | ||
module: 'web-worker-helper', | ||
options: {}, | ||
}; |
@@ -992,3 +992,3 @@ (function (global, factory) { | ||
// GENERAL UTILS | ||
const version = '0.0.2'; | ||
// WORKER OBJECTS | ||
@@ -999,6 +999,4 @@ /** A null worker to test that worker processing is functional */ | ||
name: 'null', | ||
module: 'worker-utils', | ||
options: { | ||
null: {}, | ||
}, | ||
module: 'web-worker-helper', | ||
options: {}, | ||
}; | ||
@@ -1022,2 +1020,3 @@ | ||
exports.processOnWorker = processOnWorker; | ||
exports.version = version; | ||
@@ -1024,0 +1023,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
{ | ||
"name": "web-worker-helper", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Utilities for running tasks on worker threads", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
# web-worker-helper | ||
> Forked from [@loaders.gl/worker-utils](https://github.com/visgl/loaders.gl/blob/master/modules/worker-utils/README.md) refactoring | ||
> Forked from [@loaders.gl/worker-utils](https://github.com/visgl/loaders.gl/blob/master/modules/worker-utils/README.md) implementation | ||
## 耗时任务 | ||
## Time consuming task | ||
@@ -22,3 +22,3 @@ ```ts | ||
## 创建耗时任务的 worker | ||
## Creating workers for time-consuming task | ||
@@ -36,7 +36,7 @@ ```ts | ||
## 打包 worker 文件为 umd | ||
## Bundle worker | ||
## 主线程调用 worker | ||
## Main thread call worker | ||
1. 解析 worker | ||
1. parse worker | ||
@@ -48,5 +48,6 @@ ```ts | ||
const url = getWorkerURL (workerName, options); | ||
// const source = `codeString` | ||
const workerFarm = WorkerFarm.getWorkerFarm({ maxConcurrency: 3, reuseWorkers: true }); | ||
const workerPool = workerFarm.getWorkerPool({ name: workerName, url }) | ||
// const workerPool = workerController.getWorkerPool({ name: workerName, url }); | ||
// const workerPool = workerFarm.getWorkerPool({ name: workerName, source }); | ||
const job = await workerPool.startJob(workerName, (job, type, data) => job.done(data)); | ||
@@ -60,3 +61,3 @@ | ||
2. 调用耗时任务 | ||
2. Call time-consuming task | ||
@@ -63,0 +64,0 @@ ```ts |
@@ -0,1 +1,3 @@ | ||
export const version = '0.0.2'; | ||
import type { WorkerObject } from './types'; | ||
@@ -45,6 +47,4 @@ | ||
name: 'null', | ||
module: 'worker-utils', | ||
options: { | ||
null: {}, | ||
}, | ||
module: 'web-worker-helper', | ||
options: {}, | ||
}; |
Sorry, the diff of this file is not supported yet
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
74
8
325695
96
6127