-
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.
Partially fixed a bug with
MutableMeta
observable wrappers.
- Loading branch information
Showing
17 changed files
with
125 additions
and
44 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
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
3 changes: 3 additions & 0 deletions
3
dataforge-context/src/wasmJsMain/kotlin/space/kscience/dataforge/context/loggingWasm.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,3 @@ | ||
package space.kscience.dataforge.context | ||
|
||
internal actual fun getGlobalLoggerFactory(): PluginFactory<out LogManager> = DefaultLogManager |
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
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 |
---|---|---|
|
@@ -6,6 +6,7 @@ kscience { | |
jvm() | ||
js() | ||
native() | ||
wasm() | ||
useSerialization{ | ||
json() | ||
} | ||
|
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
49 changes: 49 additions & 0 deletions
49
dataforge-meta/src/commonTest/kotlin/space/kscience/dataforge/meta/ObservableMetaTest.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,49 @@ | ||
package space.kscience.dataforge.meta | ||
|
||
import space.kscience.dataforge.names.startsWith | ||
import kotlin.test.Ignore | ||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
|
||
class ObservableMetaTest { | ||
|
||
@Test | ||
fun asObservable() { | ||
val meta = MutableMeta { | ||
"data" put { | ||
"x" put ListValue(1, 2, 3) | ||
"y" put ListValue(5, 6, 7) | ||
"type" put "scatter" | ||
} | ||
}.asObservable() | ||
|
||
assertEquals("scatter", meta["data.type"].string) | ||
} | ||
|
||
@Test | ||
@Ignore | ||
fun detachNode() { | ||
val meta = MutableMeta { | ||
"data" put { | ||
"x" put ListValue(1, 2, 3) | ||
"y" put ListValue(5, 6, 7) | ||
"type" put "scatter" | ||
} | ||
}.asObservable() | ||
|
||
var collector: Value? = null | ||
|
||
meta.onChange(null) { name -> | ||
if (name.startsWith("data")) { | ||
collector = get("data.z")?.value | ||
} | ||
} | ||
|
||
val data = meta["data"]!! | ||
|
||
meta.remove("data") | ||
|
||
data["z"] = ListValue(2, 5, 7) | ||
assertEquals(null, collector) | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
dataforge-meta/src/jsMain/kotlin/space/kscience/dataforge/misc/castJs.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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package space.kscience.dataforge.misc | ||
import kotlin.js.unsafeCast as unsafeCastJs | ||
|
||
@Suppress("UNCHECKED_CAST", "NOTHING_TO_INLINE") | ||
public actual inline fun <T> Any?.unsafeCast(): T = this.unsafeCastJs<T>() | ||
@Suppress("NOTHING_TO_INLINE") | ||
public actual inline fun <T> Any?.unsafeCast(): T = unsafeCastJs<T>() |
2 changes: 1 addition & 1 deletion
2
dataforge-meta/src/nativeMain/kotlin/space/kscience/dataforge/misc/castNative.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package space.kscience.dataforge.misc | ||
|
||
@Suppress("UNCHECKED_CAST", "NOTHING_TO_INLINE") | ||
@Suppress("UNCHECKED_CAST") | ||
public actual inline fun <T> Any?.unsafeCast(): T = this as T |
4 changes: 4 additions & 0 deletions
4
dataforge-meta/src/wasmJsMain/kotlin/space/kscience/dataforge/misc/castWasm.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,4 @@ | ||
package space.kscience.dataforge.misc | ||
|
||
@Suppress("UNCHECKED_CAST", "NOTHING_TO_INLINE") | ||
public actual inline fun <T> Any?.unsafeCast(): T = this as T |
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