
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
bs-webworkers
Advanced tools
This repository contains bindings for the Web Workers API.
Read more about these here, but keep in mind these bindings have been improved since this article was written.
The main script creates a new Web Worker from the worker.re
script and posts a message to it. The Web Worker replies back to that message. The main thread listens to that and prints out the message it received from the Web Worker.
main.re
let worker = WebWorkers.create_webworker("worker.bs.js");
let msg = {"text": "Hello world"};
WebWorkers.postMessage(worker, msg);
let msgBackHandler = (e: WebWorkers.MessageEvent.t) => {
Js.log("I am the main thread and I have received a message back from the worker:");
Js.log(WebWorkers.MessageEvent.data(e))
};
WebWorkers.onMessage(worker, msgBackHandler);
worker.re
WebWorkers.setWorkerOnMessage(
WebWorkers.self,
(e: WebWorkers.MessageEvent.t) => {
Js.log("I am the Web Worker and I have received a message:");
Js.log(WebWorkers.MessageEvent.data(e));
WebWorkers.postMessageFromWorker("my result")
}
);
npm install --save bs-webworkers
bsconfig.json
:{
"bs-dependencies": [
"bs-webworkers"
]
}
Look in the example/
directory for an example of how to use the bindings.
npm install
npm run build
npm install
npm run test
npm install
npm run example
The full Web Workers API is still not yet implemented (e.g. Shared Workers, Service Worker, WorkerNavigator, WorkerLocation, etc.). PRs are welcome!
FAQs
Bucklescript bindings for Web Workers
We found that bs-webworkers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.