Package oolong

Types

Link copied to clipboard
typealias Dispatch<Msg> = (Msg) -> Unit

A function to dispatch a Msg to the runtime in the runtime context.

Link copied to clipboard
typealias Effect<Msg> = suspend CoroutineScope.(Dispatch<Msg>) -> Any?

A function to run a side-effect in the effect context. Provides a Dispatch function to dispatch a Msg to the runtime in the runtime context.

Functions

Link copied to clipboard
fun <Msg> effect(block: Effect<Msg>): Effect<Msg>

Effect builder function.

Link copied to clipboard
fun <Model, Msg> init(block: () -> Pair<Model, Effect<Msg>>): () -> Pair<Model, Effect<Msg>>

Init builder function.

Link copied to clipboard
fun <Props> render(block: (Props) -> Any?): (Props) -> Any?

Render builder function.

Link copied to clipboard
fun <Model, Msg, Props> runtime(    init: () -> Pair<Model, Effect<Msg>>,     update: (Msg, Model) -> Pair<Model, Effect<Msg>>,     view: (Model, Dispatch<Msg>) -> Props,     render: (Props) -> Any?,     runtimeContext: CoroutineContext = Dispatchers.Default,     renderContext: CoroutineContext = Dispatchers.Main,     effectContext: CoroutineContext = Dispatchers.Default): Job

Create a runtime.

Link copied to clipboard
fun <Model, Msg> update(block: (Msg, Model) -> Pair<Model, Effect<Msg>>): (Msg, Model) -> Pair<Model, Effect<Msg>>

Update builder function.

Link copied to clipboard
fun <Model, Msg, Props> view(block: (Model, Dispatch<Msg>) -> Props): (Model, Dispatch<Msg>) -> Props

View builder function.