Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion samples/advanced-markers-draggable/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async function init() {
mapElement.append(draggableMarker);
// [END maps_advanced_markers_draggable_marker]

draggableMarker.addListener('dragend', () => {
draggableMarker.addEventListener('gmp-dragend', () => {
const position = draggableMarker.position!;
infoWindow.close();
infoWindow.setContent(`Pin dropped at: ${JSON.stringify(position)}`);
Expand Down
2 changes: 1 addition & 1 deletion samples/advanced-markers-html/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
title: property.description,
});

advancedMarkerElement.addListener('click', () => {
advancedMarkerElement.addEventListener('gmp-click', () => {
toggleHighlight(advancedMarkerElement);
});
}
Expand Down Expand Up @@ -72,17 +72,17 @@
<div>
<i aria-hidden="true" class="fa fa-bed fa-lg bed" title="bedroom"></i>
<span class="fa-sr-only">bedroom</span>
<span>${property.bed}</span>

Check warning on line 75 in samples/advanced-markers-html/index.ts

View workflow job for this annotation

GitHub Actions / Playwright PR/Push Tests

Invalid type "number" of template literal expression

Check warning on line 75 in samples/advanced-markers-html/index.ts

View workflow job for this annotation

GitHub Actions / Playwright PR/Push Tests

Invalid type "number" of template literal expression
</div>
<div>
<i aria-hidden="true" class="fa fa-bath fa-lg bath" title="bathroom"></i>
<span class="fa-sr-only">bathroom</span>
<span>${property.bath}</span>

Check warning on line 80 in samples/advanced-markers-html/index.ts

View workflow job for this annotation

GitHub Actions / Playwright PR/Push Tests

Invalid type "number" of template literal expression

Check warning on line 80 in samples/advanced-markers-html/index.ts

View workflow job for this annotation

GitHub Actions / Playwright PR/Push Tests

Invalid type "number" of template literal expression
</div>
<div>
<i aria-hidden="true" class="fa fa-ruler fa-lg size" title="size"></i>
<span class="fa-sr-only">size</span>
<span>${property.size} ft<sup>2</sup></span>

Check warning on line 85 in samples/advanced-markers-html/index.ts

View workflow job for this annotation

GitHub Actions / Playwright PR/Push Tests

Invalid type "number" of template literal expression

Check warning on line 85 in samples/advanced-markers-html/index.ts

View workflow job for this annotation

GitHub Actions / Playwright PR/Push Tests

Invalid type "number" of template literal expression
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion samples/ai-powered-summaries-basic/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
// Add text to layout.
address.textContent = place.formattedAddress ?? '';
summary.textContent = overviewText ?? 'No summary is available.';
attribution.textContent = overviewText ? `${disclosureText} ` : '';

Check warning on line 79 in samples/ai-powered-summaries-basic/index.ts

View workflow job for this annotation

GitHub Actions / Playwright PR/Push Tests

Invalid type "string | null | undefined" of template literal expression

Check warning on line 79 in samples/ai-powered-summaries-basic/index.ts

View workflow job for this annotation

GitHub Actions / Playwright PR/Push Tests

Invalid type "string | null | undefined" of template literal expression
if (overviewText) attribution.appendChild(reportingLink);

content.append(address, lineBreak, summary, lineBreak, attribution);
Expand All @@ -84,7 +84,7 @@
innerMap.setCenter(place.location!);

// Handle marker click.
marker.addListener('gmp-click', () => {
marker.addEventListener('gmp-click', () => {
showInfoWindow(marker, place, content);
});

Expand Down
2 changes: 1 addition & 1 deletion samples/event-closure/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async function attachSecretMessage(
content: secretMessage,
});

marker.addListener('gmp-click', () => {
marker.addEventListener('gmp-click', () => {
infoWindow.open(marker.map, marker);
});
}
Expand Down
2 changes: 1 addition & 1 deletion samples/place-nearby-search/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
// Build the content of the InfoWindow safely using DOM elements.
const content = document.createElement('div');
const address = document.createElement('div');
address.textContent = place.formattedAddress || '';

Check warning on line 100 in samples/place-nearby-search/index.ts

View workflow job for this annotation

GitHub Actions / Playwright PR/Push Tests

Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator

Check warning on line 100 in samples/place-nearby-search/index.ts

View workflow job for this annotation

GitHub Actions / Playwright PR/Push Tests

Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator
const placeId = document.createElement('div');
placeId.textContent = place.id;
content.append(address, placeId);
Expand All @@ -110,7 +110,7 @@
content.appendChild(link);
}

marker.addListener('gmp-click', () => {
marker.addEventListener('gmp-click', () => {
innerMap.panTo(place.location!);
updateInfoWindow(place.displayName!, content, marker);
});
Expand Down
2 changes: 1 addition & 1 deletion samples/place-text-search/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async function findPlaces(query: string) {
});
markers[place.id] = marker;

marker.addListener('gmp-click', () => {
marker.addEventListener('gmp-click', () => {
map.panTo(place.location!);
updateInfoWindow(place.displayName!, place.id, marker);
});
Expand Down
13 changes: 7 additions & 6 deletions samples/polyline-utility/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ async function init(): Promise<void> {
const [
{ Polyline },
{ AdvancedMarkerElement },
{ LatLng, LatLngBounds, event },
{ LatLng, LatLngBounds },
{ PlaceAutocompleteElement },
geometryLibrary,
] = await Promise.all([
Expand Down Expand Up @@ -112,9 +112,7 @@ async function init(): Promise<void> {
gmpDraggable: true,
});

marker.addListener('dragend', () => {
rebuildPathFromMarkers();
});
marker.addEventListener('gmp-dragend', rebuildPathFromMarkers);

markers.push(marker);
updateOutputs();
Expand All @@ -133,7 +131,10 @@ async function init(): Promise<void> {

function removePoint(index: number) {
if (index >= 0 && index < markers.length) {
event.clearInstanceListeners(markers[index]);
Comment thread
willum070 marked this conversation as resolved.
markers[index].removeEventListener(
'gmp-dragend',
rebuildPathFromMarkers
);
markers[index].map = null;
markers.splice(index, 1);
rebuildPathFromMarkers();
Expand All @@ -142,7 +143,7 @@ async function init(): Promise<void> {

function clearAll() {
markers.forEach((m) => {
event.clearInstanceListeners(m);
Comment thread
willum070 marked this conversation as resolved.
m.removeEventListener('gmp-dragend', rebuildPathFromMarkers);
m.map = null;
});
markers = [];
Expand Down
2 changes: 1 addition & 1 deletion samples/ui-kit-advanced-place-search-nearby/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ async function addMarkers() {
markers.set(place.id, marker);
bounds.extend(place.location);

marker.addListener('click', () => {
marker.addEventListener('gmp-click', () => {
placeRequest.place = place;
infoWindow.open(map.innerMap, marker);
});
Expand Down
2 changes: 1 addition & 1 deletion samples/ui-kit-advanced-place-search-text/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ async function addMarkers() {
markers.set(place.id, marker);
bounds.extend(place.location);

marker.addListener('click', () => {
marker.addEventListener('gmp-click', () => {
placeRequest.place = place;
infoWindow.open(map.innerMap, marker);
});
Expand Down
2 changes: 1 addition & 1 deletion samples/ui-kit-place-search-nearby/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
)!;
const placeDetails = document.querySelector('gmp-place-details-compact')!;
const placeRequest = document.querySelector('gmp-place-details-place-request')!;
const typeSelect = document.querySelector('.type-select') as HTMLSelectElement;

Check warning on line 17 in samples/ui-kit-place-search-nearby/index.ts

View workflow job for this annotation

GitHub Actions / Playwright PR/Push Tests

Use a ! assertion to more succinctly remove null and undefined from the type

Check warning on line 17 in samples/ui-kit-place-search-nearby/index.ts

View workflow job for this annotation

GitHub Actions / Playwright PR/Push Tests

Use a ! assertion to more succinctly remove null and undefined from the type
/* [END maps_ui_kit_place_search_nearby_query_selectors] */

// Global variables for the map, markers, and info window.
Expand Down Expand Up @@ -106,7 +106,7 @@
markers.set(place.id, marker);
bounds.extend(place.location);

marker.addListener('click', () => {
marker.addEventListener('gmp-click', () => {
placeRequest.place = place;
infoWindow.open(map.innerMap, marker);
});
Expand Down
2 changes: 1 addition & 1 deletion samples/ui-kit-place-search-text/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
)!;
const placeDetails = document.querySelector('gmp-place-details-compact')!;
const placeRequest = document.querySelector('gmp-place-details-place-request')!;
const queryInput = document.querySelector('.query-input') as HTMLInputElement;

Check warning on line 17 in samples/ui-kit-place-search-text/index.ts

View workflow job for this annotation

GitHub Actions / Playwright PR/Push Tests

Use a ! assertion to more succinctly remove null and undefined from the type

Check warning on line 17 in samples/ui-kit-place-search-text/index.ts

View workflow job for this annotation

GitHub Actions / Playwright PR/Push Tests

Use a ! assertion to more succinctly remove null and undefined from the type
const searchButton = document.querySelector('.search-button')!;
/* [END maps_ui_kit_place_search_text_query_selectors] */

Expand Down Expand Up @@ -116,7 +116,7 @@
markers.set(place.id, marker);
bounds.extend(place.location);

marker.addListener('click', () => {
marker.addEventListener('gmp-click', () => {
placeRequest.place = place;
infoWindow.open(map.innerMap, marker);
});
Expand Down