Skip to content

kite-core / jp.co.cyberagent.kite.core / KiteDslScope

KiteDslScope

interface KiteDslScope : CoroutineScope

Define a scope for kite DSL. All kite DSL (like state, memo, etc) is an extension on KiteDslScope. KiteDslScope implements CoroutineScope so you can start coroutine via launch, and async.

Properties

Name Summary
kiteContext abstract val kiteContext:KiteContext
The KiteContext of this scope.

Extension Properties

Name Summary
defaultDispatcher valKiteDslScope.defaultDispatcher: CoroutineDispatcher
Returns the KiteCoroutineDispatchers.default in current context.
ioDispatcher valKiteDslScope.ioDispatcher: CoroutineDispatcher
Returns the KiteCoroutineDispatchers.io in this current context.
mainDispatcher valKiteDslScope.mainDispatcher: CoroutineDispatcher
Returns the KiteCoroutineDispatchers.main in current context.

Extension Functions

Name Summary
asKiteContextElement fun <T :Any>T.asKiteContextElement():Pair<KClass<*>,Any>
Creates a KiteContextElement with the KClass
memo fun <T>KiteDslScope.memo(computation:KiteMemoScope.() ->T):KiteState<T>
Evaluate the computation during the computation. The evaluation result will be cached into a KiteState.
state fun <T>KiteDslScope.state(initialValue: () ->T):KiteMutableState<T>
Find the KiteStateCreator in current context and use it to create a KiteState with initialValue.
subscribe funKiteDslScope.subscribe(action:KiteSubscribeScope.() ->Unit):Unit
Run the action during the action.
withKiteContext funKiteDslScope.withKiteContext(context:KiteContext, block:KiteDslScope.() ->Unit):Unit
Calls the kite DSL with a given KiteContext.