Made a .toUInt8Array() function in JsUtil.kt file.

This commit is contained in:
PlaceboAddict authored and kildishevps committed 2025-01-22 23:07:02 +03:00
1 parent 4bea64ad21
commit 2fdecba847
2 files changed
+10

No files matched your search

@@ -13,6 +13,15 @@ fun UByteArray.toByteArray() : ByteArray {
return toByteArray()
}
fun UByteArray.toUInt8Array() : Uint8Array {
var jsArray = JsArray<JsNumber>()
for (i in this.indices) {
jsArray[i] = this[i].toInt().toJsNumber()
}
var uint8Result = Uint8Array(jsArray)
return uint8Result
}
fun Uint8Array.toUByteArray() : UByteArray {
if (length == null) {
@@ -26,6 +26,7 @@ actual object LibsodiumInitializer {
JsSodiumLoader.loadWithCallback {
isPlatformInitialized = true
done()
// TODO: there's no return needed!!!
"null".toJsString()
}
}