If I understand correctly I think that this can help in the following case: - Client send a request - For some reason the timeout is called so the client remove the function to prevent memory leaks. - The server suddenly replies. - callback && callback() make sure that the client won't fire an error.
Thank you very much for the detailed explanation. On Sun, Mar 22, 2009 at 10:05 PM, Mike Williams <[email protected]>wrote: > > It's not a double callback, it's just a test to see if the callback > function exists before calling it. > > Javascript only evaluates the expressions necessary to determine whether > a logical expression is true or false. So if I write > (1==2 && foo()) > Javascript notices that 1==2 is false, and knows that (False && True) > and (False && False) are both False. So it doesn't need to evaluate > foo() in order to determine that the whole expression is False, and it > doesn't call foo(). > > In the case of > _xdc_._1fsm2u0k2 && _xdc_._1fsm2u0k2(...) > if _xdc_._1fsm2u0k2 is undefined or void or null, then Javascript > doesn't need to evaluate _xdc_._1fsm2u0k2(...) to determine that the > whole expression is false. > On the other hand, if _xdc_._1fsm2u0k2 is a real function reference, in > boolean context that's considered True, so Javascript has to evaluate > the rest of the logical expression in order to determine if the entire > expression is True or False. > > -- > http://econym.org.uk/gmap > The Blackpool Community Church Javascript Team > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
