cpal/examples/wasm-beep
Anatol Ulrich db04f57be4
migrate wasm example to trunk (#844)
## Description

This PR migrates the wasm example from an npm/webpack based approach to [trunk](https://trunkrs.dev/). Fixes #834.

Of note:
the `console_error_panic_hook` dependency was gated in `Cargo.toml` via `[target."cfg(debug_assertions)".dependencies]`. This is documented as nonfunctional and will throw a warning on build:
```
warning: Found `debug_assertions` in `target.'cfg(...)'.dependencies`. 
This value is not supported for selecting dependencies and will not work as expected. 
To learn more visit https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#platform-specific-dependencies
```

Since the actual usage of `console_error_panic_hook` is *also* gated in `lib.rs` behind `#[cfg(debug_assertions)]` it didn't make sense to have the cargo gate in place, hence I have removed it.

## Next steps

If this PR is merged, the [wiki page](https://github.com/RustAudio/cpal/wiki/Setting-up-a-new-CPAL-WASM-project) linked in the root README should be updated as well.
2024-02-25 01:49:53 +01:00
..
src migrate wasm example to trunk (#844) 2024-02-25 01:49:53 +01:00
.gitignore migrate wasm example to trunk (#844) 2024-02-25 01:49:53 +01:00
Cargo.toml migrate wasm example to trunk (#844) 2024-02-25 01:49:53 +01:00
index.html Add wasm-beep example 2020-05-25 15:32:51 +02:00
README.md migrate wasm example to trunk (#844) 2024-02-25 01:49:53 +01:00

How to install

trunk is used to build and serve the example.

cargo install --locked trunk
# -- or --
cargo binstall trunk

How to run in debug mode

# Builds the project and opens it in a new browser tab. Auto-reloads when the project changes.
trunk serve --open

How to build in release mode

# Builds the project in release mode and places it into the `dist` folder.
trunk build --release

What does each file do?

  • Cargo.toml contains the standard Rust metadata. You put your Rust dependencies in here. You must change this file with your details (name, description, version, authors, categories)

  • The src folder contains your Rust code.