提交 11a63b51 编写于 作者: M Mislav Marohnić

Rework the Installation section

No longer recommend es6-promise due to its size and the fact it doesn't
conform to Promises/A+. Fixes #415
上级 51c8c58a
...@@ -9,37 +9,25 @@ possible to the standard Fetch specification at https://fetch.spec.whatwg.org. ...@@ -9,37 +9,25 @@ possible to the standard Fetch specification at https://fetch.spec.whatwg.org.
## Installation ## Installation
Available on [Bower](http://bower.io) as **fetch**. * `npm install whatwg-fetch --save`; or
```sh * `bower install fetch`.
$ bower install fetch
```
You'll also need a Promise polyfill for [older browsers](http://caniuse.com/#feat=promises).
```sh
$ bower install es6-promise
```
This can also be installed with `npm`.
```sh
$ npm install whatwg-fetch --save
```
For a node.js implementation, try [node-fetch](https://github.com/bitinn/node-fetch). You will also need a Promise polyfill for [older browsers](http://caniuse.com/#feat=promises).
We recommend [taylorhakes/promise-polyfill](https://github.com/taylorhakes/promise-polyfill)
for its small size and Promises/A+ compatibility.
For use with webpack, add this package in the `entry` configuration option before your application entry point: For use with webpack, add this package in the `entry` configuration option
before your application entry point:
```javascript ```javascript
entry: ['whatwg-fetch', ...] entry: ['whatwg-fetch', ...]
``` ```
For babel and es2015+, make sure to import the file: For Babel and ES2015+, make sure to import the file:
```javascript ```javascript
import 'whatwg-fetch'; import 'whatwg-fetch'
fetch(...);
``` ```
## Usage ## Usage
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册