iantearle / darksky.net-javascript-api

Darksky.net Javascript API
http://iantearle.com
65 stars 33 forks source link

Develop #12

Closed rjbultitude closed 8 years ago

rjbultitude commented 8 years ago

Hello again Ian

This request supersedes the one from my master branch. It solves the same issue but uses the official ES6 Promise object rather than jQuery to handle the asynchronous requests and is consequently a more lightweight and future-proof solution. I have included Jake Archibald's excellent polyfill to ensure it works in browsers that don't support Promises.

If you would rather merge these changes into my master and make a new merge request let me know.

Just to reiterate what this merge request covers:

The initial objective for the refactor was to deal with issue #6 "Synchronous XHR requests deprecated in many modern browsers" The synchronous GET request was blocking the main thread and temporarily preventing any user interaction with the browser.

The other objective was to allow the API to handle multiple requests, so that developers can pass in as many geolocations as they wish and get results for each.

Other fixes include:

The recent update you made to the url string (f3eb2db) I also updated the readme to include some more detailed instructions and references.

All the best

Rich