{"library":"web-worker","type":"library","category":null,"description":"`web-worker` is a JavaScript library providing a consistent, cross-platform Web Worker API that operates natively in both browser environments and Node.js. It achieves this by aliasing to the browser's native `Worker` constructor when bundled for the browser and implementing a web-compatible `Worker` atop Node.js's `worker_threads` module. The current stable version is 1.5.0, with a fairly active release cadence addressing bug fixes, compatibility improvements, and new features like Bun support and `importScripts()`. Key differentiators include its ability to make worker code compatible across environments, native support for Module Workers in Node 12.8+, use of DOM-style events (`Event.data`, `Event.type`), support for event handler properties (`worker.onmessage`), and acceptance of module, Blob, or Data URLs. It also emulates `WorkerGlobalScope` within the worker context, offering a familiar environment for developers.","language":"javascript","status":"active","version":"1.5.0","tags":["javascript","worker","worker_threads","webworker","web worker","web-worker","threads","typescript"],"last_verified":"Wed May 27","install":[{"cmd":"npm install web-worker","imports":["import Worker from 'web-worker';","const Worker = require('web-worker');","import type { WorkerOptions } from 'web-worker';"]},{"cmd":"yarn add web-worker","imports":[]},{"cmd":"pnpm add web-worker","imports":[]}],"homepage":null,"github":"https://github.com/developit/web-worker","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/web-worker","openapi_spec":null,"status_page":null,"smithery":null,"compatibility":{"summary":{"python_range":"18–22","success_rate":0,"avg_install_s":null,"avg_import_s":null,"wheel_type":null},"url":"https://checklist.day/v1/registry/web-worker/compatibility"}}