mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-04-25 06:02:13 +00:00
[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:
parent
2b0a4178bf
commit
ae6f4a9c87
@ -2,7 +2,7 @@ const rust = import('./pkg');
|
|||||||
|
|
||||||
rust
|
rust
|
||||||
.then(m => {
|
.then(m => {
|
||||||
return m.run().then((data) => {
|
return m.run("rustwasm/wasm-bindgen").then((data) => {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
|
||||||
console.log("The latest commit to the wasm-bindgen %s branch is:", data.name);
|
console.log("The latest commit to the wasm-bindgen %s branch is:", data.name);
|
||||||
|
@ -33,13 +33,15 @@ pub struct Signature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
pub async fn run() -> Result<JsValue, JsValue> {
|
pub async fn run(repo: String) -> Result<JsValue, JsValue> {
|
||||||
let mut opts = RequestInit::new();
|
let mut opts = RequestInit::new();
|
||||||
opts.method("GET");
|
opts.method("GET");
|
||||||
opts.mode(RequestMode::Cors);
|
opts.mode(RequestMode::Cors);
|
||||||
|
|
||||||
|
let url = format!("https://api.github.com/repos/{}/branches/master", repo);
|
||||||
|
|
||||||
let request = Request::new_with_str_and_init(
|
let request = Request::new_with_str_and_init(
|
||||||
"https://api.github.com/repos/rustwasm/wasm-bindgen/branches/master",
|
&url,
|
||||||
&opts,
|
&opts,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user