RunScope

class RunScope(val section: Section, scope: CoroutineScope) : SectionScope

A scope associated with the run function.

While its Lifecycle is probably almost the same as its section's lifecycle, it is a little shorter, and this matters because some data may need to be cleaned up after running but before the block is actually finished.

Constructors

Link copied to clipboard
constructor(section: Section, scope: CoroutineScope)

Types

Link copied to clipboard

Properties

Link copied to clipboard
open override val data: ConcurrentScopedData

Data store for this session.

Link copied to clipboard

The Section this run block is attached to.

Functions

Link copied to clipboard
fun RunScope.addShutdownHook(dispose: () -> Unit)

Add some dispose logic, tied to the current section, which should run if the user tries to exit the application via Ctrl-C.

Link copied to clipboard
fun RunScope.addTimer(duration: Duration, repeat: Boolean = false, key: Any? = null, callback: TimerScope.() -> Unit)

Add a timer that will be fired as long as the current section is still running.

Link copied to clipboard
fun RunScope.aside(render: AsideRenderScope.() -> Unit)

A one-off render block that can be triggered within a RenderScope.run block.

Link copied to clipboard

Programmatically trigger an "input entered" event.

Link copied to clipboard
fun SectionScope.getInput(id: Any = Unit): String?

Fetch the current value of some input call from anywhere within a RunScope.run block, if one is set.

Link copied to clipboard

A callback you can register in a RunScope.run block that will get triggered any time an input gains focus.

Link copied to clipboard

A callback you can register in a RunScope.run block that will get triggered any time the changes their input.

Link copied to clipboard

A callback you can register in a RunScope.run block that will get triggered any time an input loses focus.

Link copied to clipboard

A callback you can register in a RunScope.run block which will get triggered any time the user presses the ENTER key an input area that has focus.

Link copied to clipboard

A handler you can register in a RunScope.run block to intercept keypresses.

Link copied to clipboard
fun rerender()

Request an additional rerender pass against the underlying section.

Link copied to clipboard
fun RunScope.sendKeys(vararg keys: Key)

Send one or more Key presses programmatically.

Link copied to clipboard
fun RunScope.setInput(text: String, cursorIndex: Int = text.length, id: Any = Unit)

Set the value for some input call directly from anywhere in a RunScope.run block.

Link copied to clipboard

Fire a signal so that waitForSignal is allowed to continue.

Link copied to clipboard
suspend fun waitForSignal()

Block this method from continuing until signal is called.