launchIn

fun launchIn(scope: CoroutineScope, interval: Duration): Job(source)

Launches a coroutine in scope that calls sampleOnce and then waits interval, until the scope or the returned Job is cancelled. The first sample is taken immediately. The job never swallows cancellation.

Return

the Job of the sampling loop; cancel it to stop sampling.

Parameters

scope

scope that owns the sampling coroutine.

interval

delay between samples; must be positive.

Throws