Replies: 4 comments 3 replies
|
Sure. Can share a snippet of the code you are using with promises, to explain how to use |
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) |
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"
)
} |
1 reply
|
thank you very much |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
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.
All reactions