Is there any easy way to send_message after a promise #3036
-
Is there any built-in way to send_message after a Promise was resolved? Currently I am using a function like this to achieve it. pub(crate) fn after_resolved<T:yew::Component>(scope: yew::html::Scope<T>, promise: js_sys::Promise, message: T::Message) {
prokio::spawn_local(async move {
wasm_bindgen_futures::JsFuture::from(promise).await.unwrap();
scope.send_message(message);
});
} |
Beta Was this translation helpful? Give feedback.
Answered by
WorldSEnder
Dec 11, 2022
Replies: 1 comment
-
scope.send_future(async move {
wasm_bindgen_futures::JsFuture::from(promise).await.unwrap();
message
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
whizsid
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Scope::send_future
should be what you are after: