feat: wit-bindgen-sample

This commit is contained in:
2022-07-23 10:48:31 +08:00
parent a116b1c2e6
commit 7d769d3a0f
5 changed files with 31 additions and 22 deletions

View File

@@ -30,15 +30,15 @@ fn main() -> Result<()> {
)?;
let a = exports.eval_javascript(&mut store, r##"
function hi(name) { return "hi: " + name; }
let a = [];
a.push(fetch('https://hatter.ink/util/print_request.action'));
for (let i = 0; i < 3; i++) { a.push(i); }
a.push({
id: 1, name: 'hatter'
});
a.push(hi('001'));
a.push(hi('002'));
// let a = fetch('https://hatter.ink/util/print_request.action');
// let a = [];
// a.push(fetch('https://hatter.ink/util/print_request.action'));
// for (let i = 0; i < 3; i++) { a.push(i); }
// a.push({
// id: 1, name: 'hatter'
// });
// a.push(hi('001'));
// a.push(hi('002'));
let a = fetch('https://hatter.ink/util/print_request.action');
JSON.stringify(a)
// a
"##);