whileAttached

fun whileAttached(runner: suspend CoroutineScope.() -> Unit): CancellationToken

Registers runner to be launched each time this lifecycle is attached to a scope and cancelled once detached.