On Mon, Nov 1, 2010 at 11:23 AM, Andre Tannus <[email protected]>wrote:

> Great pointers, thanks a bunch!
>
> Michael Bolin mentions that in his book (which I strongly recommend by the
> way, if anyone else is interested). Apparently, the Closure Compiler will
> consider a literal property name (declared with an array-like notation) as
> something the developer doesn't want to have optimized/obfuscated.
>

That's right.


> There are indeed cases in which I need to append properties to GM objects,
> particularly when __gm_id doesn't cut it or when I need to create in the GM
> object an awareness of the soundings (the wrapper for instance), so
>
> shape = new CustomShape( /* constructor provides a CustomShape.id*/ );
> shape.poly = new google.maps.Polygon(...);
> shape.poly['parentId'] = shape.id;
>
> or something in this line. Of course the second and third lines happen
> within the constructor, but I'm lazy to fix that now.
>
> Do you think using the __gm_id property has any serious disadvantages other
> than not having the guarantee that it'll the same the next time 'round, when
> I F5 the app?
>

The disadvantage is that __gm_id is undocumented: we may change or remove it
in future, which may cause your page to spontaneously break.


> Also, what's the deal with the messed up events? Why are some events simple
> objects with just lat/long, and others are more complex dom events, with a
> long property chain and stuff like event.responseValue, yadda yadda? Why
> aren't all events triggered in the map following the same pattern?
>

There are several types of event (listed in the v3
reference<http://code.google.com/apis/maps/documentation/javascript/reference.html>).
 These include:

   - "Event"s are generated by the DOM and simply forwarded to the API
   object.  For example, marker event "click" is a DOM event.
   - "MouseEvent"s are synthesized from lower-level events.  For example,
   marker event "drag" is not fired by the browser but synthesized by the API
   for your benefit.
   - "KmlMouseEvent" and "FusionTablesMouseEvent" are specialized events
   which forward more information than just a MouseEvent.  For example,
   clicking on a feature in a KmlLayer or FusionTablesLayer fetches metadata
   for that feature which is then sent to your listener.



> Should I move this question to a different (perhaps a new) post?
>

If your question about events relates to implementing wrapper objects, it's
fine to continue in this thread.


> Thank you!!!
>
> --
> 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
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-maps-js-api-v3%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-maps-js-api-v3?hl=en.
>

-- 
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 [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-js-api-v3?hl=en.

Reply via email to