From c7c22e3db1c826bcfb2bc66651ec480aae0d4ae0 Mon Sep 17 00:00:00 2001 From: yo mama Date: Sat, 4 Apr 2015 01:00:59 -0700 Subject: first --- .../webworker-threads/examples/quickIntro_oneThread.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 node_modules/webworker-threads/examples/quickIntro_oneThread.js (limited to 'node_modules/webworker-threads/examples/quickIntro_oneThread.js') diff --git a/node_modules/webworker-threads/examples/quickIntro_oneThread.js b/node_modules/webworker-threads/examples/quickIntro_oneThread.js new file mode 100644 index 0000000..82f342d --- /dev/null +++ b/node_modules/webworker-threads/examples/quickIntro_oneThread.js @@ -0,0 +1,17 @@ +function fibo (n) { + return n > 1 ? fibo(n - 1) + fibo(n - 2) : 1; +} + +function cb (err, data) { + process.stdout.write(data); + this.eval('fibo(35)', cb); +} + +var thread= require('webworker-threads').create(); + +thread.eval(fibo).eval('fibo(35)', cb); + +(function spinForever () { + process.stdout.write("."); + process.nextTick(spinForever); +})(); -- cgit v1.2.3-70-g09d2