Skip to content

Commit 1076ebe

Browse files
Fix: KMP dependency resolution for native and Wasm targets, rollback createStateMachineBlocking
1 parent e2efd3f commit 1076ebe

2 files changed

Lines changed: 58 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Author: Mikhail Fedotov
3+
* Github: https://github.com/KStateMachine
4+
* Copyright (c) 2024.
5+
* All rights reserved.
6+
*/
7+
8+
package ru.nsk.kstatemachine.statemachine
9+
10+
import kotlinx.coroutines.CoroutineScope
11+
import ru.nsk.kstatemachine.coroutines.CoroutinesLibCoroutineAbstraction
12+
import ru.nsk.kstatemachine.coroutines.createStateMachine
13+
import ru.nsk.kstatemachine.state.ChildMode
14+
15+
/**
16+
* Blocking [createStateMachine] alternative
17+
*/
18+
fun createStateMachineBlocking(
19+
scope: CoroutineScope,
20+
name: String? = null,
21+
childMode: ChildMode = ChildMode.EXCLUSIVE,
22+
start: Boolean = true,
23+
creationArguments: CreationArguments = buildCreationArguments {},
24+
init: suspend BuildingStateMachine.() -> Unit
25+
) = with(CoroutinesLibCoroutineAbstraction(scope)) {
26+
runBlocking {
27+
createStateMachine(name, childMode, start, creationArguments, init)
28+
}
29+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Author: Mikhail Fedotov
3+
* Github: https://github.com/KStateMachine
4+
* Copyright (c) 2024.
5+
* All rights reserved.
6+
*/
7+
8+
package ru.nsk.kstatemachine.statemachine
9+
10+
import kotlinx.coroutines.CoroutineScope
11+
import ru.nsk.kstatemachine.coroutines.CoroutinesLibCoroutineAbstraction
12+
import ru.nsk.kstatemachine.coroutines.createStateMachine
13+
import ru.nsk.kstatemachine.state.ChildMode
14+
15+
/**
16+
* Blocking [createStateMachine] alternative
17+
*/
18+
fun createStateMachineBlocking(
19+
scope: CoroutineScope,
20+
name: String? = null,
21+
childMode: ChildMode = ChildMode.EXCLUSIVE,
22+
start: Boolean = true,
23+
creationArguments: CreationArguments = buildCreationArguments {},
24+
init: suspend BuildingStateMachine.() -> Unit
25+
) = with(CoroutinesLibCoroutineAbstraction(scope)) {
26+
runBlocking {
27+
createStateMachine(name, childMode, start, creationArguments, init)
28+
}
29+
}

0 commit comments

Comments
 (0)