LazyGoal

open class LazyGoal<T>(coroutineContext: CoroutineContext, dependencies: Collection<Goal<*>>, block: suspend () -> T) : Goal<T>

Parameters

coroutineContext

additional context information

Constructors

LazyGoal
Link copied to clipboard
common
fun <T> LazyGoal(coroutineContext: CoroutineContext = EmptyCoroutineContext, dependencies: Collection<Goal<*>> = emptyList(), block: suspend () -> T)

Functions

async
Link copied to clipboard
common
open override fun async(coroutineScope: CoroutineScope): Deferred<T>

Get ongoing computation or start a new one. Does not guarantee thread safety. In case of multi-thread access, could create orphan computations. If GoalExecutionRestriction is present in the coroutineScope context, the call could produce a error a warning depending on the settings.

reset
Link copied to clipboard
common
open override fun reset()

Reset the computation

Properties

block
Link copied to clipboard
common
val block: suspend () -> T
deferred
Link copied to clipboard
common
override var deferred: Deferred<T>? = null

Returns current running coroutine if the goal is started. Null if the computation is not started.

dependencies
Link copied to clipboard
common
open override val dependencies: Collection<Goal<*>>