
Product
Microsoft Teams Notifications Are Now Available in Socket
Socket can now send alerts and supply chain attack notifications to Microsoft Teams, with filters that route the right updates to each channel.
Run a function in a Worker thread and get back a promise
npm install offload-fn
import offloadFunction from 'offload-fn';
const result = await offloadFunction((a, b) => a + b, 2, 3);
//=> 5
// CPU-intensive work
const sum = await offloadFunction(n => {
let total = 0;
for (let i = 0; i < n; i++) {
total += i;
}
return total;
}, 1_000_000);
Returns a Promise that resolves with the function's return value.
Serializes the function to a string and runs it inside a Worker thread. Arguments and return values must be serializable via the structured clone algorithm.
Type: Function
The function to execute in a Worker thread.
Type: unknown[]
Arguments to pass to the function.
MIT
FAQs
Run a function in a Worker thread and get back a promise
We found that offload-fn demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Product
Socket can now send alerts and supply chain attack notifications to Microsoft Teams, with filters that route the right updates to each channel.

Security News
pnpm 12 rewrites the package manager in Rust, cutting install times by up to 90% while preserving pnpm 11 workflows and lockfiles.

Security News
Socket CTO Ahmad Nassri joins AppSec leaders at Black Hat to discuss active malware, package manager risks, and software supply chain defense.