I have a custom class/object in a script. In one of the object methods, when I run the following commands:
MapLabel.prototype.show = function()
{
console.log(this); // Here are the
console.log(this.canvas); // lines in question
if (!this.canvas) // this is not giving the expected result
{
console.log('canvas doesnt exist to show');
return;
}
console.log('showing maplabel');
this.visible = true;
this.canvas.style['visibility'] = 'visible';
this.marker.setVisible(true);
}
I get the following:
MapLabel {gm_accessors_: Object, fontFamily: "'Droid Sans', 'Helvetica Neue',
Helvetica, Arial, sans-serif", gm_bindings_: Object, fontSize: 14, fontColor: "#FFFFFF"…}
__e3_: Object
align: "center"
canvas: <canvas>
fontColor: "#FFFFFF"
fontFamily: "'Droid Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif"
fontSize: 14
gm_accessors_: Object
gm_bindings_: Object
gm_props_: Hu
id: 216
map: xh
marker: Ah
markerImage: Qh.MarkerImage
minZoom: 5
position: Q
strokeColor: "#000000"
strokeWeight: 4
text: "Sometext"
visible: false
zIndex: 100
__proto__: Dh
undefined // <---- this.canvas = undefined even though it exists?
You can see in the output that this.canvas exists and has a value. But when console.log(this.canvas) is run immediately afterwords, it returns undefined.
Is there something I'm missing here?
Updated: I added the function that the code is being called in
_e3_down is not part of MapLabel. I would expect all of that stuff to be within the{}...at the end of the {} is just what Chrome dev tools spits out cause it doesn't want to list everything. It's not until I expand it that it shows all the attributes in alphabetical order.