Made a .toUInt8Array() function in JsUtil.kt file.
This commit is contained in:
parent
4bea64ad21
commit
2fdecba847
@ -13,6 +13,15 @@ fun UByteArray.toByteArray() : ByteArray {
|
|||||||
return toByteArray()
|
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 {
|
fun Uint8Array.toUByteArray() : UByteArray {
|
||||||
if (length == null) {
|
if (length == null) {
|
||||||
|
@ -26,6 +26,7 @@ actual object LibsodiumInitializer {
|
|||||||
JsSodiumLoader.loadWithCallback {
|
JsSodiumLoader.loadWithCallback {
|
||||||
isPlatformInitialized = true
|
isPlatformInitialized = true
|
||||||
done()
|
done()
|
||||||
|
// TODO: there's no return needed!!!
|
||||||
"null".toJsString()
|
"null".toJsString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user