You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
letmut resp = String::new();let xhr = XmlHttpRequest::new();
xhr.open("GET",&api_url)?;
xhr.send()?;
xhr.add_event_listener(|e:ReadyStateChangeEvent| {let target:XmlHttpRequest = e.target().unwrap().try_into().unwrap();if target.ready_state() == XhrReadyState::Done{//resp = xhr.response_text().unwrap().unwrap();
resp = target.response_text().unwrap().unwrap().to_string();}});// do stuff with the respone, but only if the response is not empty
I can't use move on the clousure, otherwhise i get value borrowed after move as an error.
The text was updated successfully, but these errors were encountered:
xhr.add_event_listener(move |e: ReadyStateChangeEvent| {
// Magically retrieve the request object through js and std::web
let xhr = Reference::from(e.target().unwrap()).downcast::<XmlHttpRequest>().unwrap();
match xhr.ready_state() {
XhrReadyState::Done => {
...
But you won't be able to retrieve the headers easily until #381 is merged
I can't use move on the clousure, otherwhise i get
value borrowed after move
as an error.The text was updated successfully, but these errors were encountered: