https://github.com/idea2app/taro-fetch-polyfill
W3C fetch() API polyfill for Taro 3+
https://github.com/idea2app/taro-fetch-polyfill
api fetch mini-app mini-program polyfill taro w3c wechat
Last synced: 3 months ago
JSON representation
W3C fetch() API polyfill for Taro 3+
- Host: GitHub
- URL: https://github.com/idea2app/taro-fetch-polyfill
- Owner: idea2app
- Created: 2022-08-11T19:01:35.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-10-28T11:56:16.000Z (12 months ago)
- Last Synced: 2024-10-28T14:24:08.828Z (12 months ago)
- Topics: api, fetch, mini-app, mini-program, polyfill, taro, w3c, wechat
- Language: TypeScript
- Homepage: https://idea2app.github.io/Taro-Fetch-polyfill/
- Size: 115 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: ReadMe.md
Awesome Lists containing this project
README
# Taro Fetch polyfill
[Taro][1] 3+ 非官方 W3C [`fetch()` API][2] 补丁
[][3]
[][4][][5]
## 用法
> ❗因小程序锁定了全局对象,无法采用标准的 polyfill 方式,只能用 ponyfill 来导入。
```javascript
import { fetch } from 'taro-fetch-polyfill';fetch('https://api.github.com')
.then(response => response.json())
.then(console.log);
```[1]: https://taro.jd.com/
[2]: https://developer.mozilla.org/zh-CN/docs/Web/API/Fetch_API
[3]: https://libraries.io/npm/taro-fetch-polyfill
[4]: https://github.com/idea2app/Taro-Fetch-polyfill/actions/workflows/main.yml
[5]: https://nodei.co/npm/taro-fetch-polyfill/