mapbox / mapbox-gl-accessibility

An accessibility control for Mapbox GL JS
https://labs.mapbox.com/mapbox-gl-accessibility
ISC License
68 stars 21 forks source link

Convert proposed class property arrow funcs; #32

Closed allthesignals closed 4 years ago

allthesignals commented 4 years ago

I was having trouble getting this to build because babel did not like the syntax of the class property arrow functions. Other ES features work.

Instead I just moved these array function methods into to the constructor until we can understand why this babel feature isn’t working. This is what would happen if babel transpilation worked.

This is a workaround to get the thing to build. This change helps:

  1. Others get up and running
  2. Makes it possible to import through webpack

One possible step forward towards closing #17

tristen commented 4 years ago

👋 Thanks for the PR @allthesignals. Instead of throwing the methods in the constructor I wonder if its cleaner to omit those arrow functions entirely and bind them to this in the constructor i.e

this.queryFeatures = this.queryFeatures.bind(this)

What do you think?

allthesignals commented 4 years ago

👋 Thanks for the PR @allthesignals. Instead of throwing the methods in the constructor I wonder if its cleaner to omit those arrow functions entirely and bind them to this in the constructor i.e

this.queryFeatures = this.queryFeatures.bind(this)

What do you think?

@tristen Yep! That will make for a smaller diff, too.

I'll update. Thanks for the feedback :)