I’m trying to find a possible solution to avoid this error. If I’m not wrong, one of the principal sugests to avoid it is obviusly to change the GMP version to the current one, but in this case is not possible to all. I was trying to adapt the code for a resilient solution but it continues give an error in devtools, this is the section and the other tries:
original
const createMarker = (marker) => {
const advancedMarker = new window.google.maps.marker.AdvancedMarkerElement({
content: marker.icon,
position: marker.markerPosition,
zIndex: marker.zIndex,
});
// Add the data-marker-element="true" to the container element of the AdvancedMarkerElement,
// with the purpose getting the main div of the marker.
advancedMarker.element.dataset.markerElement = 'true';
advancedMarker.element.setAttribute('aria-label', marker.description);
** advancedMarker.addEventListener('gmp-click', marker.events.click.bind(null, marker));
mapInstance.markers.push(advancedMarker);
hashMarker(marker, advancedMarker);**
};
1st try
** advancedMarker.addEventListener('gmp-click', (event) => {
marker.events.click.bind(null, marker)(event);
});
mapInstance.markers.push(advancedMarker);
hashMarker(marker, advancedMarker);**
2nd try
** advancedMarker.addEventListener('gmp-click', (event) => {
marker.events.click.bind(null, marker)(event);
mapInstance.markers.push(advancedMarker);
hashMarker(marker, advancedMarker);
});**
Also, I was trying to use the on() method instead the “addEventListener” but the error mentions that the on() method it wans’t a funcion.
Im trying to avoid the error using the addEventListener
for the gmp-click
Roberto Lezama is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.