mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-16 18:20:51 +00:00
This commit renames the `static` attribute to `namespace` and simultaneously reduces and expands the scope. The `namespace` attribute can now be applied to all imports in addition to functions, and it no longer recognizes full typed paths but rather just a bare identifier. The `namespace` attribute will generate a Rust namespace to invoke the item through if one doesn't already exist (aka bindign a type).
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 youconsole_log
- a showcase of#[wasm_bindgen]
importing classes and how to bindconsole.log
dom
- an example of accessing the globaldocument
object and appending HTML to itsmorgasboard
- 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