wretch
    Preparing search index...

    Interface AbortWretch

    interface AbortWretch {
        signal: <T extends AbortWretch, C, R, E>(
            this: T & Wretch<T, C, R, E>,
            controller: AbortController,
        ) => this;
    }
    Index

    Properties

    Properties

    signal: <T extends AbortWretch, C, R, E>(
        this: T & Wretch<T, C, R, E>,
        controller: AbortController,
    ) => this

    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 Declaration

      • <T extends AbortWretch, C, R, E>(
            this: T & Wretch<T, C, R, E>,
            controller: AbortController,
        ): this
      • Type Parameters

        Parameters

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

          An instance of AbortController

        Returns this