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:KiteContextThe KiteContext of this scope. |
Extension Properties¶
| Name | Summary |
|---|---|
| defaultDispatcher | valKiteDslScope.defaultDispatcher: CoroutineDispatcherReturns the KiteCoroutineDispatchers.default in current context. |
| ioDispatcher | valKiteDslScope.ioDispatcher: CoroutineDispatcherReturns the KiteCoroutineDispatchers.io in this current context. |
| mainDispatcher | valKiteDslScope.mainDispatcher: CoroutineDispatcherReturns 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):UnitRun the action during the action. |
| withKiteContext | funKiteDslScope.withKiteContext(context:KiteContext, block:KiteDslScope.() ->Unit):UnitCalls the kite DSL with a given KiteContext. |