Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let mut opts = web_sys::RequestInit::new();
- opts.method("GET");
- opts.mode(web_sys::RequestMode::Cors);
- let request = web_sys::Request::new_with_str_and_init(
- "http://api.ipify.org?format=json",
- &opts,
- )?;
- let window = web_sys::window().unwrap();
- let resp: js_sys::Promise = window.fetch_with_request(&request);
- let mut fut = wasm_bindgen_futures::JsFuture::from(resp);
- fut.poll();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement