Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oliverjash/fun-task-fetch
fetch API implemented using the Task type, which allows cancellation amongst other things.
https://github.com/oliverjash/fun-task-fetch
fetch fetch-api functional-programming task
Last synced: 8 days ago
JSON representation
fetch API implemented using the Task type, which allows cancellation amongst other things.
- Host: GitHub
- URL: https://github.com/oliverjash/fun-task-fetch
- Owner: OliverJAsh
- Created: 2017-02-22T11:41:21.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-22T11:41:26.000Z (almost 8 years ago)
- Last Synced: 2024-11-16T05:41:40.467Z (2 months ago)
- Topics: fetch, fetch-api, functional-programming, task
- Language: JavaScript
- Homepage:
- Size: 17.6 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fun-task fetch
[`fetch`](https://developer.mozilla.org/en/docs/Web/API/Fetch_API) API implemented using the [`Task`
type](https://github.com/rpominov/fun-task), which [allows cancellation amongst
other things](https://github.com/rpominov/fun-task#what-is-a-task).This is just a proof of concept and needs more work. Example:
``` js
import cancellableFetch from './index';const url = 'https://jsonplaceholder.typicode.com/posts'
const task = cancellableFetch(url, { method: 'GET' })const cancel = task.run({
success(result) {
console.log('success', { result })
},
failure(result) {
console.log('failure', { result })
}
})setTimeout(cancel, 500)
```## Development
```
yarn
yarn build
```