I have a class function in Typescript that adds a circle to google maps and adds an event listener. Within that listener I want to reference this
, asign the object I am adding the listener too. See this as a reference on how it would work in pure JS
Unfortunately Typescript stops me from referencing the correct this, how do I fix this (problem, as opposed to this)?
public drawGeoFence(/* params removed */) : void {
google.maps.event.addListener(circle, "mouseover", (event) => {
this.showGeofenceInfoWindow(map, geofence, this); // <<- this!
});
}