- A state managing library for kotlin
- It can manage state with dependency
- kotlin
- jvm
- js
pom.xml
<dependency>
<groupId>net.kigawa</groupId>
<artifactId>hakate</artifactId>
<version>1.0.0</version>
</dependency>
build.gradle.kts
implementation("net.kigawa:hakate:1.0.0")
new state
val initializer = HakateInitializer()
val dispatcher = initializer.newStateDispatcher()
val state = stateDispatcher.newState("default value")
collect state
stateDispatcher.useState {
state.collect {
value = it
isSet = true
}
}
child state
stateDispatcher.useState {
val child = state.child { parent, prev: String? ->
return@child "$parent-child"
}
}
set state
state.set("new value")
- kigawa
- 9: major, destructive
- 1: miner, new function
- 2: miner, bug fix
- org.jetbrains.kotlinx:kotlinx-coroutines-core
- org.jetbrains.kotlin:kotlin-stdlib-js
- org.jetbrains.kotlin:kotlin-stdlib
- cl.franciscosolis.sonatype-central-upload
- com.vanniktech.maven.publish
- gradle
- github
- io.github.gradle-nexus.publish-plugin:io.github.gradle-nexus.publish-plugin.gradle.plugin
- kotlin
- org.gradle.toolchains.foojay-resolver-convention
- org.jetbrains.dokka
- org.jetbrains.kotlin:kotlin-test-common
- org.jetbrains.kotlin:kotlin-test-annotations-common
- org.jetbrains.kotlin:kotlin-test-junit
- org.jetbrains.kotlinx:kotlinx-coroutines-test
- org.jetbrains.kotlin:kotlin-test
- org.jetbrains.kotlin.multiplatform