pgriess / node-webworker

A WebWorkers implementation for NodeJS
BSD 3-Clause "New" or "Revised" License
646 stars 84 forks source link

is there anyway to figure out if child worker is started(or not)? #30

Open yyfrankyy opened 13 years ago

yyfrankyy commented 13 years ago

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.)?

diversario commented 13 years ago

Same over here, worker fails silently if anything is wrong.

rfunduk commented 13 years ago

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.