Fixed JsUtil.kt, Uint8Array type to ByteArray

This commit is contained in:
PlaceboAddict authored and kildishevps committed 2025-01-22 23:07:02 +03:00
1 parent f161aef4ac
commit f7bb312273
1 file changed
+4 -4
@@ -8,14 +8,14 @@ import org.khronos.webgl.get
* ugljesa.jovanovic@ionspin.com * ugljesa.jovanovic@ionspin.com
* on 02-Aug-2020 * on 02-Aug-2020
*/ */
fun UByteArray.toUInt8Array() : Uint8Array { fun UByteArray.toByteArray() : ByteArray {
val uint8Result = Uint8Array(toByteArray().toTypedArray()) // val uint8Result = ByteArray(toTypedArray())
return uint8Result return toByteArray()
} }
fun Uint8Array.toUByteArray() : UByteArray { fun Uint8Array.toUByteArray() : UByteArray {
if (length.asDynamic() == undefined) { if (length == null) {
println("Error") println("Error")
} }
val result = UByteArray(length) val result = UByteArray(length)