martyjs / marty

A Javascript library for state management in React applications
http://martyjs.org
MIT License
1.09k stars 77 forks source link

Does the GitHub fetch library have to be used in HTTP Sources? #363

Closed duro closed 8 years ago

duro commented 8 years ago

...or can I use a different HTTP request library? If I do, will I loose the hook functionality?

taion commented 8 years ago

The provided methods call into the fetch global. How would you use a different library? If you e.g. override HttpStateSource#request, then you would indeed lose the hooks.

duro commented 8 years ago

OK, so what you are saying is that it is ill advised to use a different library, and the github/fetch and matthew-andrews/isomorphic-fetch libraries are pretty hard dependencies of the Marty framework.

taion commented 8 years ago

As mentioned on Gitter, you're not directly using they - they get pulled in as dependencies by Marty, and e.g. this.get and this.post on HttpStateSource internally use a fetch polyfill.

If needed, you can override HttpStateSource#request, but otherwise you won't be directly calling fetch.