[openstreetmap/openstreetmap-website] Refactor direction engines and unify structure (PR #5621)

Marwin Hochfelsner notifications at github.com
Wed Feb 5 18:34:07 UTC 2025


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/5621 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250205/4215caaa/attachment-0001.htm>


More information about the rails-dev mailing list