Skip to content

Commit a7495aa

Browse files
authored
ROU-12717: Fix name of added event to marker pop-up (#258)
* Using correct click event * Protecting the code
1 parent abbb239 commit a7495aa

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/Providers/Maps/Google/Marker/MarkerPopup.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
// eslint-disable-next-line @typescript-eslint/no-unused-vars
55
namespace Provider.Maps.Google.Marker {
66
export class MarkerPopup extends Marker implements OSFramework.Maps.Marker.IMarkerPopup {
7-
private _contentString: string;
7+
private _contentString: string = '';
88

99
protected _setMarkerEvents(): void {
1010
super._setMarkerEvents();
1111

1212
// Open the popup when the user clicks on the Marker
1313
// To close the Marker click on it and then use the ESC or the "x" on the top right corner of the popup
1414
// Or use the API method - closePopup()
15-
this._provider.addListener('click', () => {
15+
this._provider.addListener(Constants.Marker.ProviderEventNames.click, () => {
1616
this.refreshPopupContent();
1717
this.openPopup();
1818
});
@@ -36,9 +36,10 @@ namespace Provider.Maps.Google.Marker {
3636
}
3737

3838
public refreshPopupContent(): void {
39-
this._contentString = OSFramework.Maps.Helper.GetElementByUniqueId(this.uniqueId).querySelector(
40-
OSFramework.Maps.Helper.Constants.markerPopup
41-
).innerHTML;
39+
this._contentString =
40+
OSFramework.Maps.Helper.GetElementByUniqueId(this.uniqueId)?.querySelector(
41+
OSFramework.Maps.Helper.Constants.markerPopup
42+
)?.innerHTML ?? '';
4243
this.map.features.infoWindow.setPopupContent(this._contentString);
4344
}
4445
}

0 commit comments

Comments
 (0)