ti.worker icon indicating copy to clipboard operation
ti.worker copied to clipboard

Needed to use setTimeout with at least 1 millisecond for postMessage to task

Open ewindso opened this issue 12 years ago • 2 comments

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!

ewindso avatar Jun 23 '12 00:06 ewindso

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.

allenhartwig avatar Jun 29 '12 20:06 allenhartwig

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.

allenhartwig avatar Jul 04 '12 04:07 allenhartwig