Offload functions to worker threads with shared memory primitives for Node.js.
8
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 10 lines 271 B view raw
1import { mo } from '../../src/index.ts'; 2 3export const heavyWork = mo(import.meta, (item: number): number => { 4 // Simulate CPU-bound work (~50ms per item) 5 const start = Date.now(); 6 while (Date.now() - start < 50) { 7 /* busy wait */ 8 } 9 return item * item; 10});