node-webworker
node-webworker copied to clipboard
is there anyway to figure out if child worker is started(or not)?
When my child worker have some syntax error, or runtime error which outside onmessage
, onerror
callback, the parent worker does not show any message, just wait there.
Today I just use process.env.NODE_DEBUG = 0x8
to open webworker's debug mode. then I can see wwutil
's debug infomation, it does have some debug information when the worker wasn't started correctly, is there any function I can call or event I can listen to and print out those errors(instead just open webworker's debug mode as I am doing now.)?
Same over here, worker fails silently if anything is wrong.
Once strategy I've used before is to write, at the bottom of your worker file:
postMessage( { ready: true } );
...and simply receive that message in your parent after starting the worker to signify that everything went according to plan.