AbortController

A class which can be used to abort an API request after it was made.

var abortController: AbortController? by remember { mutableStateOf(null) }
LaunchedEffect(Unit) {
abortController = AbortController()
val result = window.http.get("/some/api/path", abortController = abortController)
abortController = null
}

Button(onClick = { abortController?.abort() }) {
Text("Abort")
}

Note that if you re-use the same abort controller across multiple requests, one abort call will abort them all. And if you pass an already aborted controller into a new request, it will fail immediately.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
fun abort()