graphhopper / directions-api-js-client

JavaScript client for the GraphHopper Directions API
https://graphhopper.com/api/1/examples
108 stars 85 forks source link

Remove the JQuery dependency #12

Closed boldtrn closed 7 years ago

boldtrn commented 7 years ago

I think we should get rid of the JQuery dependency. We could use https://github.com/visionmedia/superagent but probably worth a different issue. (A more popular is https://github.com/request/request but it has also a lot dependencies)

Since we only use it for simple AJAX requests we could also write plain JS as described here.

karussell commented 7 years ago

Since we only use it for simple AJAX requests we could also write plain JS as described here.

Is this portable across different browser?

boldtrn commented 7 years ago

Is this portable across different browser?

Not too sure. CanIUse seems to be rather unoptimistic.

http://caniuse.com/#search=XMLHttpRequest

On the other hand it seems for example superagend uses the same. But probably using a lib for now would be safer, as implementing all the details might be a bit of a overhead.

karussell commented 7 years ago

Yes, I also would favour the library here

boldtrn commented 7 years ago

Ok, it seems like request is not what we are looking for: https://github.com/request/request/issues/2090. It seems that the lib grows ~1.8mb. Superagent does not support IE<9. Not sure if that is an issue though.

boldtrn commented 7 years ago

So there are some alternatives, but I think superagent might be a good fit. Will try this and see how it works out.