2018-03-03 07:11:30 +03:00
|
|
|
# Examples
|
|
|
|
|
|
|
|
This directory contains a number of examples of the `#[wasm_bindgen]` macro and
|
|
|
|
how to display them in the browser. Each directory should contain a `build.sh`
|
|
|
|
which assembles all the relevant files, and then if you open up `index.html` in
|
|
|
|
a web browser you should be able to see everything in action!
|
|
|
|
|
|
|
|
The examples here are:
|
|
|
|
|
|
|
|
* `hello_world` - the "hello world" of `#[wasm_bindgen]`, aka throwing up a
|
|
|
|
dialog greeting you
|
2018-03-09 21:25:19 +03:00
|
|
|
* `console_log` - a showcase of `#[wasm_bindgen]` importing classes and how to
|
|
|
|
bind `console.log`
|
2018-03-21 20:03:40 +03:00
|
|
|
* `math` - like `console_log` except showing how to import Math-related
|
|
|
|
functions instead
|
2018-03-21 18:26:00 +03:00
|
|
|
* `dom` - an example of accessing the global `document` object and appending
|
|
|
|
HTML to it
|
2018-03-03 07:19:39 +03:00
|
|
|
* `smorgasboard` - a bunch of features all thrown into one, showing off the
|
|
|
|
various capabilities of the `#[wasm_bindgen]` macro and what you can do with
|
|
|
|
it from JS
|
2018-03-21 20:21:21 +03:00
|
|
|
* `performance` - how to import APIs like `performance.now()` and time various
|
|
|
|
operations in Rust
|
2018-03-23 03:39:48 +03:00
|
|
|
* `wasm-in-wasm` - how to interact with namespaced APIs like
|
|
|
|
`WebAssembly.Module` and shows off creation of a WebAssembly module from Rust
|
2018-04-06 18:49:21 +03:00
|
|
|
* `closures` - an example of how to invoke functions like `setInterval` or use
|
|
|
|
the `onclick` property in conjunction with closures.
|