On Mar 3, 5:29 am, Ben Appleton <apple...@google.com> wrote:
> It sounds like you're proposing to replace event listeners with event
> delegates. For example, say you have a function called "handleMarkerClick".
>
> Event listener:
>     google.maps.event.addListener(marker, 'click', handleMarkerClick);
> This allocates objects for each marker.
>
> Event delegate:
>     marker.onclick = handleMarkerClick;
> This does not allocate any objects.
>
> We use event delegates internally, and this is how the change handlers like
> marker.positionChanged work. But you're right that event delegates are not
> exposed in the API. We'll think about exposing these.
>
> Cheers
> Ben

I guess you could call it an event delegate.  It is analogous to the
use of "style sheets" for a "class" of similar elements.  For a
handful of things, you might use individual styles.  For a gazillion
things with similar characteristics, you use a define a "class".

If I understand "Function Closures" correctly, it refers to an
anonymous function defined in the argument list of a call to another
method.  Every iteration through a loop generates a unique function
with its own set of local variables.  Everything except perhaps one
local variable is redundant.  It seems like an incredibly bad idea to
me.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to