Custom callback function after route calculation

Custom callback function after route calculation

main.js
var map = new cercaliagl.Map({
  target: 'map',
  zoom: 7,
  center: new cercaliagl.LonLat(-1.8995067857179038, 40.77795650493354)
});
map.whenReady(function () {
  var routingMap = map.getMapRouting();
  var origin = new cercaliagl.LonLat(2.1589900, 41.3887900);
  var destination = new cercaliagl.LonLat(-3.7025600, 40.4165000);
  routingMap.disableAutoZoom(true);
  routingMap.setCustomCallbackFunction(function () {
    var notification = new cercaliagl.Notification('Route calculated', cercaliagl.Notification.Severity.WARNING, 60000);
    notification.display(map);
  });
  routingMap.setRoutingStep(cercaliagl.MapRouting.MarkerType.ORIGIN, origin);
  routingMap.setRoutingStep(cercaliagl.MapRouting.MarkerType.DESTINATION, destination);
});
index.html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Custom callback function after route calculation</title>
    <style>
      .map {
        width: 100%;
        height: 640px;
      }
    </style>
  </head>
  <body>
    <div id="map" class="map"></div>
    
    <link rel="stylesheet" type="text/css" href="//maps.cercalia.com/gl/v1.0/cercaliagl.css">
    <script src="//maps.cercalia.com/gl/v1.0/cercaliagl.js?key=YOUR_API_KEY"></script>
    <script src="main.js"></script>
  </body>
</html>