route(request, callback)
Retrieves directions and estimated travel time based on the specified start and end points.
Declaration
route(
request: DirectionsRequest,
callback: (
error: Error | null,
result: DirectionsResponse | null,
) => void,
): Promise<DirectionsResponse>;Parameters
- request:
A Directionsrequest object that specifies details for the directions you want to retrieve.
- callback:
A callback function that receives the directions, returned asynchronously.
Return Value
A promise that resolves with a DirectionsResponse on success.
Discussion
Call the route(request, callback) method to get directions.
MapKit JS returns directions asynchronously via a callback function. This callback function is invoked with two arguments, error on failure and data on success.
error contains an error code and a text description of the error. data is a DirectionsResponse object with the following two properties: