0.0.3 • Published 2 years ago

@yafetch/plugin-retry v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@yafetch/plugin-retry

license

About

This plugin is part of yafetch

Usage

const yafetch  = require('@yafetch/core')
const pluginRetry = require('@yafetch/plugin-retry')
// or
import yafetch, { GlobalOptions } from '@yafetch/core'
import pluginRetry from '@yafetch/plugin-retry'
// then, add plugin in global options
GlobalOptions.yafetch = {
  // ... other options, if any
  plugins: {
    wrap: [
      pluginRetry({
        delay: 2
      })
    ]
  }
}
// or in a per-request options
const res = await yafetch('< string url or Request object >', {
  // ... other options, if any
  plugins: {
    wrap: [
      pluginRetry({
        delay: 2
      })
    ]
  }
  // ... other options, if any
})

See plugin-retry documentation for more information.

Previous work

This plugin was inspired by vercel/fetch-retry.