ti.worker
ti.worker copied to clipboard
Needed to use setTimeout with at least 1 millisecond for postMessage to task
Just fyi... I was following the example but it wasn't working... but when I did a setTimeout() with 1 millisecond for posting to the task, it worked.
Thanks btw -- this is great and what I've been waiting for for Titanium!
Same problem here. It would be great to have a 'ready' event for the worker so we know when we can begin posting data to it... or have the createWorker method run synchronously.
I'm finding that I need a timeout upwards of 1000ms otherwise if worker.postMessage(...)
is called from within the worker script, it won't fire properly. This results in no error on SDK 2.0.2, however, on 2.1.0 it errors out with:
unrecognized selector sent to instance
on the line within the worker script calling the postMessage method.