1.0.1 • Published 8 years ago
iso-whatwg-fetch v1.0.1
iso-whatwg-fetch
UMD Fetch Module build on top of WHATWG Fetch polyfill & node-fetch
Warnings
- You must bring your own ES6 Promise compatible polyfill,WHATWG suggest es6-promise.
Installation
npm install --save iso-whatwg-fetch
Usage
commonjs/commonjs2
// you should load you own promise polyfil
var fetch = require('iso-whatwg-fetch');
fetch('http://www.google.com').then(function(res) {
console.log(res);
});
amd
// you should load you own promise polyfil
require('iso-whatwg-fetch', function(fetch){
fetch('http://www.google.com').then(function(res) {
console.log(res);
});
})
browser
<!-- you should load you own promise polyfill -->
<script src="/path/to/iso-whatwg-fetch/lib/index.min.js"></script>
<script type="text/javascript">
// use fetch here
fetch('http://www.google.com').then(function(res){
console.log(res);
})
</script>
fetch api doc
Please see WHATWG Fetch repo