Untangling `FOSSGISOSRMEngine` and moving from `push`ing `for` loops to 
`.map()` for the other engines.

### Description
The three routing engines' code now follows a similar structure:
```js
const ...Engine = function (id, ...) {
  function _processDirections(...) {...}

  return {
    ...,
    getRoute: function (points, callback) {
      data = {...};
      return $.ajax({
        ...,
        success: function // that calls the callback with _processDirections
      });
    }
  };
};
```

### How has this been tested?
Creating a conditional dev tools breakpoint and shoving it all in there.

You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/5621

-- Commit Summary --

  * Refactor direction engines and unify structure

-- File Changes --

    M app/assets/javascripts/index/directions/fossgis_osrm.js (265)
    M app/assets/javascripts/index/directions/fossgis_valhalla.js (189)
    M app/assets/javascripts/index/directions/graphhopper.js (124)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/5621.patch
https://github.com/openstreetmap/openstreetmap-website/pull/5621.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5621
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/5...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to