Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/skpm/sketch-polyfill-fetch
A fetch polyfill for sketch
https://github.com/skpm/sketch-polyfill-fetch
fetch polyfill sketch
Last synced: about 2 months ago
JSON representation
A fetch polyfill for sketch
- Host: GitHub
- URL: https://github.com/skpm/sketch-polyfill-fetch
- Owner: skpm
- License: mit
- Created: 2017-03-21T11:10:56.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-08-29T14:23:52.000Z (over 5 years ago)
- Last Synced: 2024-11-06T14:52:15.888Z (2 months ago)
- Topics: fetch, polyfill, sketch
- Language: JavaScript
- Size: 43.9 KB
- Stars: 63
- Watchers: 5
- Forks: 22
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sketch-polyfill-fetch
A [fetch](https://developer.mozilla.org/en/docs/Web/API/Fetch_API) polyfill for sketch inspired by [unfetch](https://github.com/developit/unfetch). It is automatically included (when needed) when using [skpm](https://github.com/skpm/skpm).
## Installation
> :warning: There is no need to install it if you are using [skpm](https://github.com/skpm/skpm)!
```bash
npm i -S sketch-polyfill-fetch
```## Usage
Using skpm:
```js
export default () => {
fetch("https://google.com")
.then(response => response.text())
.then(text => console.log(text))
.catch(e => console.error(e));
};
```Without skpm:
```js
const fetch = require("sketch-polyfill-fetch");var onRun = function() {
fetch("https://google.com")
.then(response => response.text())
.then(text => console.log(text))
.catch(e => console.error(e));
};
```> :warning: only https URLs are supported due a MacOS limitation