UNPKG

221 BJavaScriptView Raw
1function fibo (n) {
2 return n > 1 ? fibo(n - 1) + fibo(n - 2) : 1;
3}
4
5thread.on('giveMeTheFibo', function onGiveMeTheFibo (data) {
6 this.emit('theFiboIs', fibo(+data)); //Emits 'theFiboIs' in the parent/main thread.
7});
\No newline at end of file