markus-wa / demoinfocs-wasm

Parsing CS:GO demos from JavaScript with WebAssemby. Example on how to use https://github.com/markus-wa/demoinfocs-golang with WASM.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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, calls app/web/main.js
  • app/web/main.js - JS code that calls into app/main.go to parse selected files and displays results
  • app/main.go - demoinfocs-golang wrapper for WASM, exposes functions called from JS
  • app/Dockerfile - Dockerized Go runner that builds the WASM binary
  • app/Makefile - Makefile for building and running the demo app
  • app/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

  1. Execute make run
    This builds and starts an NGINX docker container with a webapp that can parse player stats from a CS:GO demo.

  2. Go to http://localhost:8080 to see the demo app.

Demo app screenshot

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.

About

Parsing CS:GO demos from JavaScript with WebAssemby. Example on how to use https://github.com/markus-wa/demoinfocs-golang with WASM.

License:MIT License


Languages

Language:JavaScript 70.7%Language:Shell 11.4%Language:Go 8.9%Language:Dockerfile 3.5%Language:Makefile 3.1%Language:HTML 1.9%Language:CSS 0.6%