@itsy/abortable
v2.0.0
Published
a convenience wrapper for AbortController
Downloads
8
Readme
@itsy/abortable
use
import { Abortable } from '@itsy/abortable'
import ky from 'ky'
let loading = false
const updater = new Abortable()
updater.callbacks({
updateCb() {
loading = true
return ky.get('/foo/bar', { signal: updater.signal })
},
catchCb(err) {
console.error('Failed to update due to', err)
},
finallyCb() {
loading = false
}
})