Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ members = [
"lib/dfx_info",
"lib/ic_http_agent",
"lib/serde_idl",
"lib/idl_wasm",
]
1 change: 1 addition & 0 deletions lib/idl_js/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
10 changes: 10 additions & 0 deletions lib/idl_js/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>idl-wasm example</title>
</head>
<body>
<script src="./index.js"></script>
</body>
</html>
13 changes: 13 additions & 0 deletions lib/idl_js/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const js = import("./node_modules/idl-wasm/idl_wasm.js");
js.then(js => {
try {
const bytes = js.js_encode([42,false, "哈哈", { 'ok': 42, 123: 'test' }, [[1,2,3],[4,5]]]);
console.log(bytes);
const args = js.js_decode(bytes);
console.log(args);
//const bytes = js.encode('(42, record { ok=opt 42; label="test" })');
//console.log(bytes);
} catch (e) {
console.error(e);
}
});
Loading