diff options
Diffstat (limited to 'node_modules/webworker-threads/examples/quickIntro_oneThread.js')
| -rw-r--r-- | node_modules/webworker-threads/examples/quickIntro_oneThread.js | 17 |
1 files changed, 17 insertions, 0 deletions
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); +})(); |
