-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
call global javascript function from rust (ugly)
- Loading branch information
1 parent
5b8ed84
commit 8712635
Showing
4 changed files
with
16 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
import init, { greet, test_hydroflow } from "wasm_test_site"; | ||
let { memory } = await init(); | ||
|
||
(window as any).writeToDom = function(str: string) { | ||
document.body.appendChild(document.createTextNode(str)); | ||
document.body.append(document.createElement('br')); | ||
}; | ||
|
||
greet(); | ||
test_hydroflow(); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,4 @@ | |
"vite-plugin-html": "^3.2.0", | ||
"vite-plugin-wasm-pack": "^0.1.12" | ||
} | ||
} | ||
} |