Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename geocodeCallback to changeCallback, call it from latlon setValue #5081

Conversation

AntonKhorev
Copy link
Collaborator

Another piece of #5064 which changes how callbacks work. The code outside endpoints module shouldn't care if geocoding was performed or not. Previously there was a special callback for completed geocoding, you waited for it and then you built the route. But if you passed coordinates to endpoint.setValue you knew that geocoding may not happen therefore you had to try to build the route right away. Now you just always wait for a callback because it happens even without geocoding.

endpoint.setValue always calls changeCallback on its successful completion, with geocoding or without. This allows to decide when to call getRoute entirely from callbacks and event listeners.
Copy link
Contributor

@nenad-vujicic nenad-vujicic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works fine on my side. Thanks!

@tomhughes
Copy link
Member

Looks good to me, thanks.

@tomhughes tomhughes merged commit a0013c8 into openstreetmap:master Aug 15, 2024
24 checks passed
@AntonKhorev AntonKhorev deleted the directions-endpoint-change-callback branch August 16, 2024 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants