wasm-bindgen/examples/webaudio
Alex Crichton 269c491380
Gate web-sys APIs on activated features (#790)
* Gate `web-sys` APIs on activated features

Currently the compile times of `web-sys` are unfortunately prohibitive,
increasing the barrier to using it. This commit updates the crate to instead
have all APIs gated by a set of Cargo features which affect what bindings are
generated at compile time (and which are then compiled by rustc). It's
significantly faster to activate only a handful of features vs all thousand of
them!

A magical env var is added to print the list of all features that should be
generated, and then necessary logic is added to ferry features from the build
script to the webidl crate which then uses that as a filter to remove items
after parsing. Currently parsing is pretty speedy so we'll unconditionally parse
all WebIDL files, but this may change in the future!

For now this will make the `web-sys` crate a bit less ergonomic to use as lots
of features will need to be specified, but it should make it much more
approachable in terms of first-user experience with compile times.

* Fix AppVeyor testing web-sys

* FIx a typo

* Udpate feature listings from rebase conflicts

* Add some crate docs and such
2018-09-05 12:55:30 -07:00
..
src Fix audio example 2018-08-30 13:45:42 -07:00
.gitignore Initial example of using the WebAudio APIs from web-sys 2018-08-17 07:02:48 -04:00
build.bat Initial example of using the WebAudio APIs from web-sys 2018-08-17 07:02:48 -04:00
build.sh Fix audio example 2018-08-30 13:45:42 -07:00
Cargo.toml Gate web-sys APIs on activated features (#790) 2018-09-05 12:55:30 -07:00
index.html Initial example of using the WebAudio APIs from web-sys 2018-08-17 07:02:48 -04:00
index.js Initial example of using the WebAudio APIs from web-sys 2018-08-17 07:02:48 -04:00
package.json Fix audio example 2018-08-30 13:45:42 -07:00
README.md Initial example of using the WebAudio APIs from web-sys 2018-08-17 07:02:48 -04:00
webpack.config.js Initial example of using the WebAudio APIs from web-sys 2018-08-17 07:02:48 -04:00

Web Audio example

This directory is an example of how to use the Web Audio APIs from Rust. It creates a very simple FM (frequency modulation) synth, and let's you control the primary frequency, the modulation amount, and the modulation frequency.

To run, first install some utilities via npm:

npm install

Then build the project with either build.bat or build.sh.

Finally, run a development web server with npm run serve and then open http://localhost:8080/ in a browser!