The JsLibsodiumLoader file has been fixed, but the quality of fix is unknown
This commit is contained in:
parent
669e8ee0c9
commit
f161aef4ac
@ -36,8 +36,13 @@ object JsSodiumLoader {
|
|||||||
//Dynamic может быть Юнит, но Unit не может быть JsAny?
|
//Dynamic может быть Юнит, но Unit не может быть JsAny?
|
||||||
continuation.resumeWith(Result.success(Unit))
|
continuation.resumeWith(Result.success(Unit))
|
||||||
null
|
null
|
||||||
}.catch { e->
|
}.catch { e ->
|
||||||
continuation.resumeWith(Result.failure(e))
|
val throwable = e as? Throwable
|
||||||
|
if (throwable != null) {
|
||||||
|
continuation.resumeWith(Result.failure(throwable))
|
||||||
|
} else {
|
||||||
|
continuation.resumeWith(Result.failure(Exception("Error: $e")))
|
||||||
|
}
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -45,9 +50,9 @@ object JsSodiumLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun loadWithCallback(doneCallback: () -> (Unit)) {
|
fun loadWithCallback(doneCallback: () -> (JsAny)) {
|
||||||
if (!getSodiumLoaded()) {
|
if (!getSodiumLoaded()) {
|
||||||
_libsodiumPromise.then<JsAny> {
|
_libsodiumPromise.then {
|
||||||
sodium_init()
|
sodium_init()
|
||||||
sodiumLoaded = true
|
sodiumLoaded = true
|
||||||
doneCallback.invoke()
|
doneCallback.invoke()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user