2018-08-06 16:35:28 -07:00
|
|
|
# `module = "blah"`
|
|
|
|
|
|
|
|
The `module` attributes configures the module from which items are imported. For
|
|
|
|
example,
|
|
|
|
|
|
|
|
```rust
|
|
|
|
#[wasm_bindgen(module = "wu/tang/clan")]
|
2018-11-27 12:27:00 -08:00
|
|
|
extern "C" {
|
2018-08-06 16:35:28 -07:00
|
|
|
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]
|
2018-11-27 12:27:00 -08:00
|
|
|
extern "C" {
|
2018-08-06 16:35:28 -07:00
|
|
|
fn illmatic() -> u32;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
generates JavaScript import glue like:
|
|
|
|
|
|
|
|
```js
|
|
|
|
let illmatic = this.illmatic;
|
|
|
|
```
|