提交 5a8b3cf8 编写于 作者: M Matthew Andrews

Document `fetch` usage with Browserify — and switch suggested Promise library...

Document `fetch` usage with Browserify — and switch suggested Promise library to one with a CommoJS API more similar to Fetch.
上级 430d871c
......@@ -15,7 +15,7 @@ $ bower install fetch
You'll also need a Promise polyfill for older browsers.
```sh
$ bower install es6-promise
$ bower install native-promise-only
```
This can be also be installed with `npm`.
......@@ -24,6 +24,35 @@ This can be also be installed with `npm`.
$ npm install github/fetch --save
```
### Using Fetch with Browserify and npm
```js
require('native-promise-only');
require('fetch');
```
Note: if you install **fetch** with npm you won't be able to specify a fuzzy
version or range of versions for **fetch** in your `package.json` as npm does
not support installing fuzzy versions from modules not published on their
registry.
Instead, you can choose ot install **fetch** at an exact specific version by
changing `package.json` to:
```json
...
"fetch": "https://github.com/github/fetch/archive/v0.1.0.tar.gz
...
```
Alternatively, if you would prefer to install **fetch** at a fuzzy version
you can install it via bower to install it and use the [debowerify transform](https://github.com/eugeneware/debowerify).
Full worked examples of these two approaches to using **fetch** in Browserify are avalable:
- [Fetch API + Browserify](https://github.com/matthew-andrews/fetch-browserify-demo)
- [Fetch API + Browserify + Bower](https://github.com/matthew-andrews/fetch-browserify-bower-demo)
## Usage
The `fetch` function supports any HTTP method. We'll focus on GET and POST
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册