The property defined on the prototype is a fallback for the property on
this.  Initializing a primitive-valued property on a prototype is nearly
indistinguishable from initializing it on each instance, with 1 less line of
code in the constructor.

On 4 Jun 2010 06:58, "nianwei" <[email protected]> wrote:

I've noticed a problem in the v3 example while reading documentation.

 In the "Add state to controls" section on this page:
http://code.google.com/apis/maps/documentation/javascript/controls.html#ControlState

There is line of code like this:

// Define a property to hold the Home state
HomeControl.prototype.home_ = null;

This is not correct. It can lead some developers to think the "home_"
property defined in this line is actually same as the "this.home_"
used in the getter and setter method, and the comments also implied
so.

The property defined in the prototype is completely different that the
actual home_ property hold by the instance (which is where the state
is actually stored) so this line of code should be removed.

See this modified example (click the controls to see results below
map)

http://gmaps-utility-gis.googlecode.com/svn/trunk/v3test/control-custom-state.html


--
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