Instead of usine setTimeout(), you could use the $timeout service from 
angular. It would look like this:

$timeout(function () {
  callSometimesAsyncFn( cb );
});

On Tuesday, April 16, 2013 at 1:48:52 PM UTC-7, Davis Ford wrote:
>
> I did solve it -- thanks to you suggestion that perhaps it wasn't 
> executing async...well the API is async (i.e. takes a callback), but it is 
> implemented by taking a function as a parameter, and then down in the guts 
> somewhere just doing a fn.call(null, params). 
>
> It is more complicated -- there is an emulator with stubbed out native 
> code, and then there's the real platform -- where it does execute 
> asynchronously b/c it crosses a native bridge.  So in the emulator, it 
> behaves synchronously, and on the target hardware it behaves asynchronously.
>
> I solved it (complete hack) by wrapping it with 
>
> setTimeout(function () {
>   callSometimesAsyncFn( cb );
> }, 0);
>
> with a timeout value of zero.  This forces a nextTick();
>
> On Tue, Apr 16, 2013 at 4:19 PM, Josh David Miller <[email protected] 
> <javascript:>> wrote:
>
>> Hmm... the issue must be within the native counterpart. Perhaps part of 
>> it is blocking. The only suggestion I have is to add a bunch of console.log 
>> statements throughout the code to see if you can establish the current 
>> execution order. Unfortunately, without code I don't have a better 
>> suggestion. :-(
>>
>> Out of curiosity, what is the native component?
>>
>> Good luck!
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to