We're only generating a Wasm module, so we can use the build task we set up in the previous chapter to compile our code. Select Tasks | Run Build Taskā¦ or use the keyboard shortcut Ctrl/Cmd + Shift + B to compile the code. If you're not using VS Code, open a CLI instance in the /chapter-06-interact-with-js folder and run the following command:
emcc js-without-glue.cpp -Os -s WASM=1 -s SIDE_MODULE=1 -s BINARYEN_ASYNC_COMPILATION=0 -o js-without-glue.wasm
Once complete, open a terminal in the /book-examples folder, and run the following command to start your local server:
serve -l 8080
Open up a browser and navigate to http://127.0.0.1:8080/chapter-06-interact-with-js/js-without-glue.html. You should see something like this:
Just as with the previous examples, if you press the Pause button, the caption on the button should change to Start and the circle should stop moving.