MyGit

4.0.0

developit/unfetch

版本发布时间: 2018-09-18 02:44:29

developit/unfetch最新发布版本:isomorphic-4.0.2(2023-01-03 10:30:59)

🦄 Small breaking change for awesome ponyness:

TL;DR: require('unfetch') no longer returns window.fetch when it exists. For that, use unfetch/polyfill.

This change makes unfetch lovely to use as a polyfill from HTML:

<script src="https://unpkg.com/unfetch/polyfill"></script>
<!-- that's it! -->
<script>foo = await fetch('/foo.json')</script>

Otherwise, if you're using Unfetch and bundling your code, continue as you were before:

if (!self.fetch) self.fetch = require('unfetch');
// or simply:
import 'unfetch/polyfill';

Important - the one thing to avoid:

Since unfetch is a proper ponyfill, it will now overwrite fetch even in supported browsers if you do the following

// never do this!
window.fetch = require('unfetch');

相关地址:原始地址 下载(tar) 下载(zip)

查看:2018-09-18发行的版本