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
.
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)