route(request)
Retrieves directions and estimated travel time based on the specified start and end points.
Declaration
route(request: DirectionsRequest): Promise<DirectionsResponse>;Parameters
- request:
A Directionsrequest object that specifies details for the directions you want to retrieve.
Return Value
A promise that resolves with a DirectionsResponse on success, or rejects with an Error on failure.
Discussion
Call the route(request) method to get directions.
The resolved DirectionsResponse object has the following properties:
request is the request object associated with this response.
routes contains an array of up to three Route objects returned by the server.
Pass an AbortSignal from an AbortController to the signal option to allow the controller to cancel a pending request. When the controller aborts, the promise it returns rejects with a DOMException whose name is "AbortError".