UNPKG

webworker-threads

Version:

Lightweight Web Worker API implementation with native threads

7 lines (6 loc) 221 B
function fibo (n) { return n > 1 ? fibo(n - 1) + fibo(n - 2) : 1; } thread.on('giveMeTheFibo', function onGiveMeTheFibo (data) { this.emit('theFiboIs', fibo(+data)); //Emits 'theFiboIs' in the parent/main thread. });