Interface AbortWretch

Hierarchy

  • AbortWretch

Properties

Properties

signal: (<T, C, R>(this, controller) => AbortWretch)

Type declaration

    • <T, C, R>(this, controller): AbortWretch
    • Associates a custom controller with the request.

      Useful when you need to use your own AbortController, otherwise wretch will create a new controller itself.

      const controller = new AbortController()

      // Associates the same controller with multiple requests
      wretch("url1")
      .addon(AbortAddon())
      .signal(controller)
      .get()
      .json()
      wretch("url2")
      .addon(AbortAddon())
      .signal(controller)
      .get()
      .json()

      // Aborts both requests
      controller.abort()

      Type Parameters

      Parameters

      • this: T & Wretch<T, C, R>
      • controller: AbortController

        An instance of AbortController

      Returns AbortWretch

Generated using TypeDoc