SingleJob

class SingleJob(scope: CoroutineScope)

Runs a single coroutine job at a time.

If a previous job is running, cancels it before launching the new one.

Constructors

Link copied to clipboard
constructor(scope: CoroutineScope)

Functions

Link copied to clipboard
fun cancel()

Cancels the current job, if any.

Link copied to clipboard
fun launch(block: suspend CoroutineScope.() -> Unit)

Launches a coroutine job.