I am wondering if we can use a dynamic variable using "self.variable"
I currently have this class which has two maps. I have a function that apply various things to the map. I want to change map on the fly calling my function with the current map in variable.
googleMap = Class.extend({
map: null,
miniMap: null,
isOverlayVisible: false,
overlay: null,
});
My script has the following code.
self.map.fitBounds(bounds);
self.map
refers to a variable defined in the class. I also have the variable self.minimap
.
How could I have the 'map' inside variable like the following:
function updateMap(currentMap){
if(typeof currentMap !== "undefined"){
currentMap = map;
}
var currentMap = 'minimap';
self.currentMap.fitBounds(bounds);
}
updateMap('minimap');
Thanks.