webworker-threads
Version:
Lightweight Web Worker API implementation with native threads
21 lines (14 loc) • 373 B
JavaScript
var t= require('../');
function killHandler (data) {
console.log("GOT KILL with data -> "+ data);
o.destroy();
}
function boot () {
thread.once('kill', function (data) {
thread.emit('kill', data);
});
}
o= t.create().once('kill', killHandler).eval(boot).eval('boot()').emit('kill', "*** DATA");
process.on('exit', function () {
console.log("Bye!");
});