Skip to content

node-fetch fork, implemented using the Task type, which allows cancellation amongst other things.

License

Notifications You must be signed in to change notification settings

OliverJAsh/node-fetch-task

 
 

Repository files navigation

node-fetch-task

node-fetch fork, implemented using the Task type, which allows cancellation amongst other things.

Currently WIP.

Also see the browser version of fetch implemented via Task.

Example

const cancellableFetch = require('./lib/index');

const url = 'https://jsonplaceholder.typicode.com/posts'
const task = cancellableFetch(url, { method: 'GET' })

const cancel = task
    .chain(response => response.json())
    .run({
        success(result) {
            console.log('success', { result })
        },
        failure(result) {
            console.log('failure', { result })
        }
    })

setTimeout(cancel, 100)

About

node-fetch fork, implemented using the Task type, which allows cancellation amongst other things.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%