question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Geo add the ability to get a reference to the map instance

See original GitHub issue

Is your feature request related to a problem? Please describe 🙏

It might happen in some cases that you directly want to interact with the map instance. Right now the only way to get this instance is through the event listeners on the markers. It would be nice to provide it as soon as the map is instantiated.

Describe the solution you’d like 🤔

We can trigger an event once the map is instantiated.

search.addWidget(
  instantsearch.widgets.geoSearch({
    container: "#geo-search-container",
    googleReference: window.google,
    events: {
      onMapCreated: instance => {
        // Do something with the instance
      }
    }
  })
);

Additional context

See https://github.com/algolia/instantsearch.js/issues/2778#issuecomment-411552188

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
samo012commented, Jul 14, 2022

For anyone still wondering, a reference to the map is passed in the events from builtInMarker and customHTMLMarker.

0reactions
bobylitocommented, Aug 10, 2018

@bobylito then it would be undefined before mounted right?

Probably indeed 😅 . Other idea: what about having a method on the widget instance that returns a promise of the map?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tips and tricks for Power BI Map visualizations - Microsoft Learn
Tips and Tricks for Power BI Map visualizations, visuals, locations, longitude and latitude, and how they work with Bing Maps.
Read more >
Map | API Reference | ArcGIS Maps SDK for JavaScript 4.25
The Map class contains properties and methods for storing, managing, and overlaying layers common to both 2D and 3D viewing. Layers can be...
Read more >
Geo chart reference - Looker Studio Help - Google Support
How to use and configure Geo charts.A Geo chart provides an easy way to visualize how a measurement varies across a geographic area....
Read more >
How to create geographic maps using Power BI - SQLShack
This is the first article of a series dedicated to discovering geographic maps in Power BI using Bubble Map and Filled Map.
Read more >
Examples | Mapbox GL JS
Add a GeoJSON line to a map using addSource, then style it using addLayer's ... Use the mapbox-gl-rtl-text plugin to support right-to-left languages...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found