[WIP] add parameter to async function --> error (#1973)

* add parameter to async function --> error

This change to the fetch example does not compile.
It would be great to include how to do this!

* fn parameter as String
This commit is contained in:
Sarah Allen
2020-01-22 07:32:47 -08:00
committed by Alex Crichton
parent 2b0a4178bf
commit ae6f4a9c87
2 changed files with 5 additions and 3 deletions

View File

@ -33,13 +33,15 @@ pub struct Signature {
}
#[wasm_bindgen]
pub async fn run() -> Result<JsValue, JsValue> {
pub async fn run(repo: String) -> Result<JsValue, JsValue> {
let mut opts = RequestInit::new();
opts.method("GET");
opts.mode(RequestMode::Cors);
let url = format!("https://api.github.com/repos/{}/branches/master", repo);
let request = Request::new_with_str_and_init(
"https://api.github.com/repos/rustwasm/wasm-bindgen/branches/master",
&url,
&opts,
)?;