1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 14:50:03 -04:00

egui_web: Add simple fetch API and demostrate it in example_web

This commit is contained in:
Emil Ernerfeldt
2020-11-18 00:43:58 +01:00
parent 0cb3bb791b
commit fad0029119
8 changed files with 1046 additions and 26 deletions

30
build_demo_web.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/bin/bash
set -eu
# Pre-requisites:
rustup target add wasm32-unknown-unknown
if ! wasm-bindgen --version; then
cargo clean
cargo install -f wasm-bindgen-cli
cargo update
fi
# BUILD=debug
BUILD=release
export RUSTFLAGS=--cfg=web_sys_unstable_apis # required for the clipboard API
# Clear output from old stuff:
rm -rf docs/demo_web.wasm
echo "Build rust:"
# cargo build -p demo_web --target wasm32-unknown-unknown
cargo build --release -p demo_web --target wasm32-unknown-unknown
echo "Generate JS bindings for wasm:"
FOLDER_NAME=${PWD##*/}
TARGET_NAME="demo_web.wasm"
wasm-bindgen "target/wasm32-unknown-unknown/$BUILD/$TARGET_NAME" \
--out-dir docs --no-modules --no-typescript
open http://localhost:8888/index.html