Replies: 4 comments 3 replies
-
Sure. Can share a snippet of the code you are using with promises, to explain how to use |
Beta Was this translation helpful? Give feedback.
0 replies
-
fun RETURN_PROMISE_WITH_USER_OBJECT(): Promise<SomeUserObject?> = CoroutineScope(Dispatchers.Default + SupervisorJob()).async {
withTimeoutOrNull(Constants.CLIENT_TIMEOUT) {
// no suspend function return Promise for create SomeUserObject
// and front-end login will decide whether to wait for the object or use a callback function
return@withTimeoutOrNull SomeUserObject
} ?: throw my_user_exceptions_class(
l_class_name = "UserObject",
l_function_name = "RETURN_PROMISE_WITH_USER_OBJECT",
name_of_exception = "EXC_SYSTEM_ERROR"
)
}.toPromise(EmptyCoroutineContext) |
Beta Was this translation helpful? Give feedback.
2 replies
-
For tha case just do not use the fun RETURN_DEFERRED_WITH_USER_OBJECT(): Deferred<SomeUserObject?> = CoroutineScope(Dispatchers.Default + SupervisorJob()).async {
withTimeoutOrNull(Constants.CLIENT_TIMEOUT) {
// no suspend function return Promise for create SomeUserObject
// and front-end login will decide whether to wait for the object or use a callback function
return@withTimeoutOrNull SomeUserObject
} ?: throw my_user_exceptions_class(
l_class_name = "UserObject",
l_function_name = "RETURN_PROMISE_WITH_USER_OBJECT",
name_of_exception = "EXC_SYSTEM_ERROR"
)
} |
Beta Was this translation helpful? Give feedback.
1 reply
-
thank you very much |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The object Promise was marked as deprecated.
It is suggested to use CompletableDeferred instead.
Could you give an example of how to do this. Thank you.
Beta Was this translation helpful? Give feedback.
All reactions