This repository has been archived by the owner on Feb 2, 2023. It is now read-only.
feat(autocomplete): add locate event when pin is clicked #1063
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Allow the pin to emit a
locate
event when clicked. This will allow integrating code to determine when a user enables geolocation in the browser and act upon it.This addresses an issue as discussed in #952.
I came across this too as I wanted to use the
places
module in a Facebook Messenger Webview. The pin icon looks like it should geolocate the user so having this as an additional event would allow me to do this without tying it to theplaces
implementation.I chose the name
locate
for the event but I'm happy to change this to a better name if appropriate. I've added a unit test for this but had to refactor the mocking ofcreateAutocompleteDataset
as it's set up prior to theplaces
instance being created before every test. I felt this was appropriate but happy to refactor this.The documentation has been updated.
Result
The
locate
event is emitted when clicking on the pin icon to allow users to determine when this has happend.