Skip to content

itsyjs/abortable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

@itsy/abortable

use

import { useAbortable } from '@itsy/abortable'

let loading = false
const updater = useAbortable()

updater.setCallbacks({
  async updateCb() {
    loading = true
    return await (await fetch('/foo/bar', { signal: updater.signal })).json()
  },
  catchCb(err) {
    console.error('Failed to update due to', err)
  },
  finallyCb() {
    loading = false
  }
})

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published