Skip to content

Commit 238549b

Browse files
authored
fix: Adds region tags for code snippets. (#739)
Change-Id: Ia0dbac151ecc82eff7e3193ff444960c33cc816e
1 parent eb13a59 commit 238549b

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

samples/routes-get-directions/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ async function initMap(): Promise<void> {
7676
};
7777
// [END maps_routes_get_directions_request_pluscode]
7878

79+
// [START maps_routes_get_directions_request_complete]
7980
// [START maps_routes_get_directions_request_simple]
8081
// Define a routes request.
8182
const request = {
@@ -87,14 +88,10 @@ async function initMap(): Promise<void> {
8788
// [END maps_routes_get_directions_request_simple]
8889

8990
// Call computeRoutes to get the directions.
90-
//@ts-ignore
9191
// [START maps_routes_get_directions_compute]
9292
const {routes, fallbackInfo, geocodingResults} = await Route.computeRoutes(request);
9393
// [END maps_routes_get_directions_compute]
9494

95-
// Display the raw JSON for the result in the console.
96-
console.log(`Response:\n ${JSON.stringify(routes, null, 2)}`);
97-
9895
// [START maps_routes_get_directions_polyline]
9996
// Use createPolylines to create polylines for the route.
10097
mapPolylines = routes[0].createPolylines();
@@ -106,7 +103,12 @@ async function initMap(): Promise<void> {
106103
// Add markers to the map
107104
markers.forEach((marker) => marker.setMap(map));
108105
// [END maps_routes_get_directions_polyline]
106+
// [END maps_routes_get_directions_request_complete]
107+
108+
// Display the raw JSON for the result in the console.
109+
console.log(`Response:\n ${JSON.stringify(routes, null, 2)}`);
109110

111+
// Fit the map to the path.
110112
fitMapToPath(routes[0].path!);
111113
}
112114

samples/routes-route-matrix/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,15 @@ async function initMap(): Promise<void> {
4848
destinationB.fetchFields({ fields: ['location', 'displayName']}),
4949
]);
5050

51+
// [START maps_routes_route_matrix_request]
5152
const request = {
5253
origins: [origin1, origin2],
5354
destinations: [destinationA, destinationB],
5455
travelMode: 'DRIVING',
5556
units: google.maps.UnitSystem.METRIC,
5657
fields: ['distanceMeters', 'durationMillis', 'condition'],
5758
};
59+
// [END maps_routes_route_matrix_request]
5860

5961
// Show the request.
6062
(document.getElementById("request") as HTMLDivElement).innerText =

0 commit comments

Comments
 (0)