OnDispose

class OnDispose(function: () -> Unit) : DisposableHandle

A Disposable executing the given function on dispose().

Example:

val disposable = OnDispose { println("disposing myself") }
disposable.dispose() // => "disposing myself"

Constructors

Link copied to clipboard
constructor(function: () -> Unit)

Functions

Link copied to clipboard
open override fun dispose()
Link copied to clipboard

Disposes the Disposable when CoroutineLauncher completes (including cancellation).

Disposes the Disposable when CoroutineContext completes (including cancellation).

fun Disposable.disposeOnCompletionOf(scope: CoroutineScope): Disposable

Disposes the Disposable when CoroutineScope completes (including cancellation).

Disposes the Disposable when Job completes (including cancellation).