summaryrefslogtreecommitdiff
path: root/node_modules/webworker-threads/test/test06_throw_from_the_thread.js
blob: 6e2ff62a13b2ebaaaa0a6336807f4d4eb090be25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
var Thread= require('webworker-threads');

function cb (e,m) {
  process.stdout.write('[ '+ e+ ', '+ m+ ' ]\n');
  this.eval(src, cb);
}

var src= 'if (++i % 2) throw("An error -> "+ i); else ("No error -> "+ i);';

Thread.create().eval('i=0').eval(src, cb);