Using F.worker2 with Total.js

98 Views Asked by At

I would like to use some args with F.worker2. Do you have some example ? How to use the F.worker2 with Total.js ?

Thank you

1

There are 1 best solutions below

0
On

Just send additional arguments https://docs.totaljs.com/latest/en.html#api~Framework~F.worker2 or send a message:

var worker = F.worker2();

// Worker has to have defined "message" event:
// process.on('message', function(msg) { console.log('Data from parent', msg); });

setImmediate(function() {
   worker.send({ simple: 'value' });
});

https://nodejs.org/dist/latest-v7.x/docs/api/child_process.html#child_process_child_send_message_sendhandle_options_callback