Skip to content

Instantly share code, notes, and snippets.

@tbfleming
Created January 13, 2018 02:57
Show Gist options
  • Save tbfleming/46d30fc0d68f058e706456ea970e7de6 to your computer and use it in GitHub Desktop.
Save tbfleming/46d30fc0d68f058e706456ea970e7de6 to your computer and use it in GitHub Desktop.
cib demo: emscripten_run_script
// 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