Geovation / labelgun

🏷️ reducing label clutter across mapping libraries
https://geovation.github.io/labelgun/
113 stars 10 forks source link

Compatibility #21

Closed tomchadwin closed 7 years ago

tomchadwin commented 7 years ago

When used in a QtWebkit environment, this fails because of no support for Set, I believe. What's the best approach - a polyfill? Or is there some option in your build process to compile a version compatible with older JS engines?

Other errors might subsequently transpire, but let's fix them as they arise.

JamesLMilner commented 7 years ago

Hey @tomchadwin, good spot. I assumed that Babel transpiled these down to ES5 but it looks like you need a Polyfill:

https://babeljs.io/docs/usage/polyfill

Sure you could use a Set specific Polyfill such as :

https://www.npmjs.com/package/es6-set

At the moment I think Set is the only ES6 feature that wouldn't get transpiled. We only use it for the data structure that determines if things have changed. Might just be easier to use a Object or Array in some fashion.

tomchadwin commented 7 years ago

If changing it to some other structure is an option, that would be great. I've no babel experience, so while I can try changing the src, I don't know the build process to generate the lib to test.

tomchadwin commented 7 years ago

Confirmed that Set is the only polyfill required, though the one I've used from polyfill.io in turn uses Symbol, so I had to use that one as well. I also had to tweak one of the polyfills as well, weirdly. Anyway, it works now, but if you are able to consider removing Set, that would simplify things a great deal.

JamesLMilner commented 7 years ago

We just use an array now in 5.0.1 :+1:

tomchadwin commented 7 years ago

I don't think the minified version has built - still has Set.

tomchadwin commented 7 years ago

Oh, and sorry about this: looks like Object.values() hasn't transpiled down either. Is that required?

tomchadwin commented 6 years ago

Looks like you've fixed all of this in v6. Nice. Thanks!

JamesLMilner commented 6 years ago

Yeah sorry, I forgot to mention I removed it :)