Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.44 KB | None | 0 0
  1.     let mut opts = web_sys::RequestInit::new();
  2.     opts.method("GET");
  3.     opts.mode(web_sys::RequestMode::Cors);
  4.  
  5.     let request = web_sys::Request::new_with_str_and_init(
  6.         "http://api.ipify.org?format=json",
  7.         &opts,
  8.     )?;
  9.  
  10.     let window = web_sys::window().unwrap();
  11.     let resp: js_sys::Promise = window.fetch_with_request(&request);
  12.  
  13.     let mut fut = wasm_bindgen_futures::JsFuture::from(resp);
  14.     fut.poll();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement