mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-15 21:02:10 +03:00
36b854b69c
This commit adds further support for the `Global` attribute to not only emit structural accessors but also emit functions that don't take `&self`. All methods on a `[Global]` interface will not require `&self` and will call functions and/or access properties on the global scope. This should enable things like: Window::location() // returns `Location` Window::fetch(...) // invokes the `fetch` function Closes #659
13 lines
354 B
Rust
13 lines
354 B
Rust
use wasm_bindgen_test::*;
|
|
|
|
include!(concat!(env!("OUT_DIR"), "/global.rs"));
|
|
|
|
#[wasm_bindgen_test]
|
|
fn works() {
|
|
assert_eq!(Global::global_no_args(), 3);
|
|
assert_eq!(Global::global_with_args("a", "b"), "ab");
|
|
assert_eq!(Global::global_attribute(), "x");
|
|
Global::set_global_attribute("y");
|
|
assert_eq!(Global::global_attribute(), "y");
|
|
}
|