Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/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.
https://github.com/markus-wa/demoinfocs-wasm
counter-strike counter-strike-global-offensive csgo demoinfo go golang javascript js wasm web-assembly
Last synced: 3 months ago
JSON representation
Parsing CS:GO demos from JavaScript with WebAssemby. Example on how to use https://github.com/markus-wa/demoinfocs-golang with WASM.
- Host: GitHub
- URL: https://github.com/markus-wa/demoinfocs-wasm
- Owner: markus-wa
- License: mit
- Created: 2020-03-28T20:20:34.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-06-01T04:57:11.000Z (over 1 year ago)
- Last Synced: 2024-07-30T21:02:19.600Z (6 months ago)
- Topics: counter-strike, counter-strike-global-offensive, csgo, demoinfo, go, golang, javascript, js, wasm, web-assembly
- Language: JavaScript
- Homepage:
- Size: 215 KB
- Stars: 11
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
- Security: security-opts-chrome.json
Awesome Lists containing this project
README
# demoinfocs-wasm example
This repo demonstrates how [demoinfocs-golang](https://github.com/markus-wa/demoinfocs-golang) can be used from JavaScript with [WebAssembly](https://webassembly.org/) (WASM).
## Interesting files
- [`app/web/index.html`](app/web/index.html) - HTML page for the UI, calls `app/web/main.js`
- [`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`](app/main.go) - demoinfocs-golang wrapper for WASM, exposes functions called from JS
- [`app/Dockerfile`](app/Dockerfile) - Dockerized Go runner that builds the WASM binary
- [`app/Makefile`](app/Makefile) - Makefile for building and running the demo app
- [`app/web/wasm_exec.js`](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`](https://www.docker.com/get-started), [`docker-compose`](https://docs.docker.com/compose/install/) and [`make`](https://www.gnu.org/software/make/).
## Running the example
1. Execute `make run`
This builds and starts an [NGINX](https://nginx.org/en/) 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](https://gitlab.com/markus-wa/demoinfocs-wasm/raw/master/e2e/golden/stats.png)
## Running tests for development
To run tests the test-demo `default.dem` needs to be downloaded using [Git LFS](https://git-lfs.github.com/) 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.