GithubHelp home page GithubHelp logo

Comments (7)

matthew-andrews avatar matthew-andrews commented on July 28, 2024

A reduced example of how to use Browserify with fetch loaded via npm:-
https://github.com/matthew-andrews/fetch-browserify-demo

And another with fetch loaded via bower (and debowerify):-
https://github.com/matthew-andrews/fetch-browserify-bower-demo

from fetch.

dgraham avatar dgraham commented on July 28, 2024

@matthew-andrews This is great. Could you create a pull request for the fetch readme that links to your examples with a little context around it? Maybe a "Using with npm" section.

from fetch.

matthew-andrews avatar matthew-andrews commented on July 28, 2024

Yup, sure — just wanted to get them working first.

from fetch.

jacobrask avatar jacobrask commented on July 28, 2024

If I understand correctly, using it with browserify will still expose it as a global. What I am concerned about is: I ship some software with github/fetch, the WHATWG Fetch API is changed, and then implemented in a browser.

Problem: if (window.fetch) return makes my code use the native API, which is not compatible with the code I wrote.
Preferred: My code uses the version of github/fetch I had downloaded, and continues to work until I can update it to the new API. When the API is implemented in my target browsers, I can just remove my require.

Am I missing some way of accomplishing this, or are they invalid concerns for some other reason?

from fetch.

matthew-andrews avatar matthew-andrews commented on July 28, 2024

That's a very valid point and no I don't think there's any way of accomplishing this without maintaining a fork.

I had similar feedback for https://github.com/matthew-andrews/Promise.prototype.finally, which was “if you modify the global, you'll make it harder for it to become a standard method”. I argued against it at the time: https://twitter.com/andrewsmatt/status/520987196757934080 but now I'm not so sure.

Fetch API has sort of already been implemented in browsers — although admittedly I've only seen this behind a flag in Chrome, and only via Service Workers so maybe that doesn't count.

from fetch.

josh avatar josh commented on July 28, 2024

@jacobrask since the entire spec is very alpha right now, I would suggest you just not use this library until things settle down.

from fetch.

josh avatar josh commented on July 28, 2024

Resolved by #29

from fetch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.