mapbox / mapbox/mapbox-gl-redux

Customize mapEvents Callback

Open
#5 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
37
Forks
3
PR merge metrics
No merged PRs in 30d

Description

Generally, whenever I use mapboxgl, I put a debounce to most of the mapEvents I am using. _(For performance reasons)_. In to-fix I noticed an insane amount of store dispatches on map move (possibly due to this https://github.com/mapbox/mapbox-gl-redux/blob/master/src/index.js#L116).?

I propose we allow mapbox-gl-redux to customize the listeners for all the mapEvents. This api would open the possibility of reducing the number of events we dispatch and even allow a wrapper callback around the listener like debounce, throttle etc.

I know `mapbox-gl-redux` tries to transparently reproduce the mapboxgl API. If there is no major concern with this proposal, I can go ahead and cut a PR to implement this feature.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/index.js around line 116, where map events appear to trigger store dispatches, and trace how listeners are registered for mapEvents. Define the callback customization surface for event listeners, including wrappers such as debounce or throttle, while preserving the existing mapbox-gl-redux API behavior. Done means callers can customize listeners and reduce dispatched events without breaking normal event handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.