We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It would be nice to have callback_future_once, as it matches nicely with callback_once. also it looks much cleaner.
callback_future_once
callback_once
self.link.callback_future_once(|_| async move { Msg::FileUploaded(upload_form.post_async().await) })
vs.
self.link.callback_future(move |_| { let upload_form = upload_form.clone(); async move { Msg::FileUploaded(upload_form.post_async().await) } }),
Implementation is pretty simple as well.
impl<COMP: Component> LinkFuture for ComponentLink<COMP> { ... fn callback_future_once<FN, FU, IN, M>(&self, function: FN) -> yew::Callback<IN> where M: Into<Self::Message>, FU: Future<Output = M> + 'static, FN: FnOnce(IN) -> FU + 'static, { let link = self.clone(); let closure = move |input: IN| { let future: FU = function(input); link.send_future(future); }; Callback::once(closure) } ... }
Does it needs more discussion, or maybe I can make a PR? :)
The text was updated successfully, but these errors were encountered:
No more discussion needed, sounds nice to have, PR is welcome @fraillt!
Sorry, something went wrong.
@jstarry has funded $5.00 to this issue.
Added callback_future_once in yewtil (#1696) (#1712)
e5eda4e
@jstarry has rewarded $4.50 to @fraillt. See it on IssueHunt
Successfully merging a pull request may close this issue.
It would be nice to have
callback_future_once
, as it matches nicely withcallback_once
.also it looks much cleaner.
vs.
Implementation is pretty simple as well.
Does it needs more discussion, or maybe I can make a PR? :)
IssueHunt Summary
fraillt has been rewarded.
Backers (Total: $5.00)
Submitted pull Requests
Tips
The text was updated successfully, but these errors were encountered: