-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from SciProgCentre/dev
0.8.0
- Loading branch information
Showing
96 changed files
with
2,394 additions
and
2,790 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,7 @@ out/ | |
.gradle | ||
build/ | ||
|
||
.kotlin | ||
|
||
|
||
!gradle-wrapper.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ plugins { | |
|
||
allprojects { | ||
group = "space.kscience" | ||
version = "0.7.1" | ||
version = "0.8.0" | ||
} | ||
|
||
subprojects { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 0 additions & 35 deletions
35
dataforge-context/src/commonMain/kotlin/space/kscience/dataforge/properties/MetaProperty.kt
This file was deleted.
Oops, something went wrong.
47 changes: 0 additions & 47 deletions
47
dataforge-context/src/commonMain/kotlin/space/kscience/dataforge/properties/Property.kt
This file was deleted.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
dataforge-context/src/commonMain/kotlin/space/kscience/dataforge/properties/metaAsFlow.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package space.kscience.dataforge.properties | ||
|
||
|
||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.Job | ||
import kotlinx.coroutines.channels.awaitClose | ||
import kotlinx.coroutines.flow.* | ||
import kotlinx.coroutines.launch | ||
import space.kscience.dataforge.meta.* | ||
import space.kscience.dataforge.misc.DFExperimental | ||
|
||
@DFExperimental | ||
public fun <T> ObservableMeta.asFlow(converter: MetaSpec<T>): Flow<T> = callbackFlow { | ||
onChange(this){ | ||
trySend(converter.read(this)) | ||
} | ||
|
||
awaitClose{ | ||
removeListener(this) | ||
} | ||
} | ||
|
||
@DFExperimental | ||
public fun <T> MutableMeta.listenTo( | ||
scope: CoroutineScope, | ||
converter: MetaConverter<T>, | ||
flow: Flow<T>, | ||
): Job = flow.onEach { | ||
update(converter.convert(it)) | ||
}.launchIn(scope) | ||
|
||
@DFExperimental | ||
public fun <T> ObservableMutableMeta.bind( | ||
scope: CoroutineScope, | ||
converter: MetaConverter<T>, | ||
flow: MutableSharedFlow<T>, | ||
): Job = scope.launch{ | ||
listenTo(this, converter,flow) | ||
onChange(flow){ | ||
launch { | ||
flow.emit(converter.read(this@onChange)) | ||
} | ||
} | ||
flow.onCompletion { | ||
removeListener(flow) | ||
} | ||
}.also { | ||
it.invokeOnCompletion { | ||
removeListener(flow) | ||
} | ||
} |
31 changes: 0 additions & 31 deletions
31
...forge-context/src/commonMain/kotlin/space/kscience/dataforge/properties/schemeProperty.kt
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
...e-context/src/commonTest/kotlin/space/kscience/dataforge/properties/MetaPropertiesTest.kt
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
dataforge-context/src/jsMain/kotlin/space/kscience/dataforge/properties/bindings.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.