Skip to content

OliverJAsh/fun-task-fetch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fun-task fetch

fetch API implemented using the Task type, which allows cancellation amongst other things.

This is just a proof of concept and needs more work. Example:

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

About

fetch API implemented using the Task type, which allows cancellation amongst other things.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published