I’m trying to write a Blazor component that uses google maps via JSInterop. I am trying to call the “DirectionsService” class and “route” method.DirectionsService Route Method
Here is my my local method:
public async Task<DirectionResponse> Route(DirectionsRequest request)
{
var json = await _jsObjectRef.InvokeAsync<string>(
"google.maps.DirectionsService.route",
request);
var directionResponse = JsonConvert.DeserializeObject<DirectionResponse>(json);
return directionResponse;
}
This method has two parameters. One is a request object. The second is a callback function. Method Definition
How can I accomplish this using the “InvokeAsync” method?
How do I include the callback function in order to receive the response properly?