W3cubDocs

/Kotlin

interceptContinuation

abstract fun <T> interceptContinuation(
    continuation: Continuation<T>
): Continuation<T>

Returns continuation that wraps the original continuation, thus intercepting all resumptions. This function is invoked by coroutines framework when needed and the resulting continuations are cached internally per each instance of the original continuation.

By convention, implementations that install themselves as the interceptor in the context with the Key shall also scan the context for other element that implement ContinuationInterceptor interface and use their interceptContinuation functions, too.