Closed jianghoy closed 4 years ago
Hmmm. I had planned to drop explicit browser support since NBA.com's CORS restrictions generally prevent use of their APIs in the browser. Which APIs are you able to access from the browser with 4.8.0?
I think some of the stats
namespace endpoints can get around CORS by using JSONP, but it seems like NBA is deprecating the stats
namespace in favor of the data
namespace which does not appear to support JSONP.
API used so far: findPlayer, playerInfo and shots
I'll look into this a little more when I get a chance. FWIW findPlayer
works because the data is baked into the package – this is generally because working with player IDs is difficult without a mapping from names to IDs.
The other reason I wanted to drop browser support is that it's been a pain in the ass to maintain. My work is primarily backend and the variety of browser bundling/compiling tools (browserify, babel, webpack, rollup, ????) is tough to navigate and keep up with. If you have any experience with these I'd love a PR that includes a browser bundling step, along with some tests that ensure the bundle works when imported with these tools.
I would be open to rewriting the main code with ES6 imports/exports if the bundler also works transparently with common.js require
.
I might try and take a stab at following the template here https://github.com/kalcifer/webpack-library-example
closing this for now. browser compatibility is not a priority although I would welcome a PR.
I'm working on replicating an existing front end project using this lib. and React. It turns that the existing project works perfectly fine with v4.8 NBA lib but mine, which uses v4.9, doesn't work as expected. I built my little forwarding server using express js though it'd be nice to point out that rollback may be a good temporary workout.