Package-level declarations

Types

Link copied to clipboard

Functions

Link copied to clipboard

Provides active states as Flow

Link copied to clipboard
suspend fun createStateMachine(scope: CoroutineScope, name: String? = null, childMode: ChildMode = ChildMode.EXCLUSIVE, start: Boolean = true, creationArguments: CreationArguments = buildCreationArguments {}, init: suspend BuildingStateMachine.() -> Unit): StateMachine

Suspendable analog of createStdLibStateMachine function, with Kotlin Coroutines support. This is preferred function. Use this one especially if you are going to use Kotlin Coroutines library from KStateMachine callbacks.

Link copied to clipboard
fun createStateMachineBlocking(scope: CoroutineScope, name: String? = null, childMode: ChildMode = ChildMode.EXCLUSIVE, start: Boolean = true, creationArguments: CreationArguments = buildCreationArguments {}, init: suspend BuildingStateMachine.() -> Unit): StateMachine

Blocking createStateMachine alternative

Link copied to clipboard
fun StateMachine.processEventByAsync(event: Event, argument: Any? = null, coroutineContext: CoroutineContext = EmptyCoroutineContext, coroutineStart: CoroutineStart = CoroutineStart.DEFAULT): Deferred<ProcessingResult>

Processes event in async fashion (using async() to start new coroutine) and returns result as Deferred.

Link copied to clipboard
fun StateMachine.processEventByLaunch(event: Event, argument: Any? = null, coroutineContext: CoroutineContext = EmptyCoroutineContext, coroutineStart: CoroutineStart = CoroutineStart.DEFAULT)

Processes event in async fashion (using launch() to start new coroutine).

Link copied to clipboard
fun StateMachine.stateMachineNotificationFlow(replay: Int = 0, extraBufferCapacity: Int = 0, onBufferOverflow: BufferOverflow = BufferOverflow.SUSPEND): SharedFlow<StateMachineNotification>