mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-05-08 12:02:17 +00:00
34 lines
545 B
Markdown
34 lines
545 B
Markdown
# `module = "blah"`
|
|
|
|
The `module` attributes configures the module from which items are imported. For
|
|
example,
|
|
|
|
```rust
|
|
#[wasm_bindgen(module = "wu/tang/clan")]
|
|
extern {
|
|
type ThirtySixChambers;
|
|
}
|
|
```
|
|
|
|
generates JavaScript import glue like:
|
|
|
|
```js
|
|
import { ThirtySixChambers } from "wu/tang/clan";
|
|
```
|
|
|
|
If a `module` attribute is not present, then the global scope is used
|
|
instead. For example,
|
|
|
|
```rust
|
|
#[wasm_bindgen]
|
|
extern {
|
|
fn illmatic() -> u32;
|
|
}
|
|
```
|
|
|
|
generates JavaScript import glue like:
|
|
|
|
```js
|
|
let illmatic = this.illmatic;
|
|
```
|