https://github.com/olyop/concurrent-processor
A simple utility that concurrently processes an array of arbitary values by offloading the execution to a web worker
https://github.com/olyop/concurrent-processor
Last synced: about 1 year ago
JSON representation
A simple utility that concurrently processes an array of arbitary values by offloading the execution to a web worker
- Host: GitHub
- URL: https://github.com/olyop/concurrent-processor
- Owner: olyop
- License: mit
- Created: 2024-04-06T00:42:28.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-08T05:29:07.000Z (about 2 years ago)
- Last Synced: 2025-03-29T04:41:31.238Z (about 1 year ago)
- Language: TypeScript
- Size: 8.79 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Concurrent Processor
A simple utility that concurrently processes an array of arbitrary values by offloading the execution to a web worker.
## Installation
```bash
npm install concurrent-processor
```
## Usage
```javascript
import { concurrentProcessor } from "concurrent-processor";
await concurrentProcessor({
workerURL, // URL to the worker script
values, // Array of values to process
onRead, // Callback function when a value is read to be passed to the worker
onProcess, // Callback function when a value has been processed
signal, // Abort signal
workerOptions, // Options to pass to new Worker(url, options)
});
```