From c7c22e3db1c826bcfb2bc66651ec480aae0d4ae0 Mon Sep 17 00:00:00 2001 From: yo mama Date: Sat, 4 Apr 2015 01:00:59 -0700 Subject: first --- .../examples/quickIntro_evented_childThreadCode.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 node_modules/webworker-threads/examples/quickIntro_evented_childThreadCode.js (limited to 'node_modules/webworker-threads/examples/quickIntro_evented_childThreadCode.js') diff --git a/node_modules/webworker-threads/examples/quickIntro_evented_childThreadCode.js b/node_modules/webworker-threads/examples/quickIntro_evented_childThreadCode.js new file mode 100644 index 0000000..ba31205 --- /dev/null +++ b/node_modules/webworker-threads/examples/quickIntro_evented_childThreadCode.js @@ -0,0 +1,7 @@ +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. +}); \ No newline at end of file -- cgit v1.2.3-70-g09d2