TaskPolicy

sealed interface TaskPolicy

Launch policy for TaskScope.launch.

Choose based on whether duplicate work should be skipped, replaced, or debounced.

Inheritors

Types

Link copied to clipboard
data class Debounce(val delay: Duration) : TaskPolicy

Cancel active, wait delay, then run. Built-in debounce for homogeneous streams.

Link copied to clipboard

Cancel the active task for this key, then start a new one.

Link copied to clipboard
data object SkipIfActive : TaskPolicy

Ignore the launch while a task with the same TaskKey is already active.