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 5933df479e8a250701d38962138377cf38a7b8b4 10 lines 301 B view raw
1import { mo } from '../../src/index.ts'; 2 3export const fibonacci = mo(import.meta, (n: number): number => { 4 // Deliberately naive recursive fibonacci — CPU-heavy but bounded 5 function fib(x: number): number { 6 if (x <= 1) return x; 7 return fib(x - 1) + fib(x - 2); 8 } 9 return fib(n); 10});