Awesome
demoinfocs-wasm example
This repo demonstrates how demoinfocs-golang can be used from JavaScript with WebAssembly (WASM).
Interesting files
app/web/index.html
- HTML page for the UI, callsapp/web/main.js
app/web/main.js
- JS code that calls intoapp/main.go
to parse selected files and displays resultsapp/main.go
- demoinfocs-golang wrapper for WASM, exposes functions called from JSapp/Dockerfile
- Dockerized Go runner that builds the WASM binaryapp/Makefile
- Makefile for building and running the demo appapp/web/wasm_exec.js
- this file is included in your Go installation (e.g./usr/share/go-1.13/misc/wasm/wasm_exec.js
)
Prerequisites
To run the example you need docker
, docker-compose
and make
.
Running the example
-
Execute
make run
<br> This builds and starts an NGINX docker container with a webapp that can parse player stats from a CS:GO demo. -
Go to
http://localhost:8080
to see the demo app.
Running tests for development
To run tests the test-demo default.dem
needs to be downloaded using Git LFS first.
This can be done with git lfs pull -I '*'
.
After this the you can run make
for a full build including unit and end-to-end tests.