Created
January 13, 2018 02:57
-
-
Save tbfleming/46d30fc0d68f058e706456ea970e7de6 to your computer and use it in GitHub Desktop.
cib demo: emscripten_run_script
This file contains hidden or 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
| // Run javascript | |
| // Use Reboot to stop | |
| #include <emscripten.h> | |
| #include <stdio.h> | |
| using namespace std; | |
| auto script = R"( | |
| Module.print('Hello from javascript!\n'); | |
| let i = 0; | |
| function count() { | |
| Module.print('i = ' + i++); | |
| setTimeout(count, 500); | |
| } | |
| count(); | |
| )"; | |
| int main() { emscripten_run_script(script); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment