Basic wasm library
This commit is contained in:
parent
d30774b8c0
commit
54236a7e51
|
@ -0,0 +1,2 @@
|
||||||
|
/target
|
||||||
|
Cargo.lock
|
|
@ -0,0 +1,12 @@
|
||||||
|
[package]
|
||||||
|
name = "audioview"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Rob Watson <rob@netflux.io>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
crate-type = ["cdylib", "rlib"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
yew = "0.17"
|
||||||
|
wasm-bindgen = "0.2"
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Based on https://raw.githubusercontent.com/saschagrunert/webapp.rs/master/Makefile
|
||||||
|
|
||||||
|
GENERAL_ARGS = --release
|
||||||
|
FRONTEND_ARGS = $(GENERAL_ARGS)
|
||||||
|
|
||||||
|
.PHONY: \
|
||||||
|
build \
|
||||||
|
run
|
||||||
|
|
||||||
|
all: build
|
||||||
|
|
||||||
|
build:
|
||||||
|
wasm-pack build --target web --out-name wasm --out-dir ./static
|
||||||
|
|
||||||
|
build-doc:
|
||||||
|
cargo doc --all --no-deps
|
||||||
|
|
||||||
|
run:
|
||||||
|
simple-http-server -i ./static/ -p 3000 --nocache --try-file ./static/index.html
|
||||||
|
|
||||||
|
lint: lint-rustfmt lint-clippy
|
||||||
|
|
||||||
|
lint-clippy:
|
||||||
|
cargo clippy --all -- -D warnings
|
||||||
|
|
||||||
|
lint-rustfmt:
|
||||||
|
cargo fmt
|
||||||
|
git diff --exit-code
|
|
@ -0,0 +1,30 @@
|
||||||
|
use wasm_bindgen::prelude::*;
|
||||||
|
use yew::prelude::*;
|
||||||
|
|
||||||
|
struct Home {}
|
||||||
|
|
||||||
|
impl Component for Home {
|
||||||
|
type Message = ();
|
||||||
|
type Properties = ();
|
||||||
|
|
||||||
|
fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self {
|
||||||
|
Self {}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn update(&mut self, _: Self::Message) -> ShouldRender {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
fn change(&mut self, _: Self::Properties) -> ShouldRender {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
fn view(&self) -> Html {
|
||||||
|
html! { <span>{"Hello World!"}</span> }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[wasm_bindgen(start)]
|
||||||
|
pub fn run_app() {
|
||||||
|
App::<Home>::new().mount_to_body();
|
||||||
|
}
|
Loading…
Reference in New Issue