wasm-bindgen/crates/macro/ui-tests
Alex Crichton a2aa28e4d3 Add a #[wasm_bindgen(start)] attribute
This commit adds a new attribute to `#[wasm_bindgen]`: `start`. The
`start` attribute can be used to indicate that a function should be
executed when the module is loaded, configuring the `start` function of
the wasm executable. While this doesn't necessarily literally configure
the `start` section, it does its best!

Only one crate in a crate graph may indicate `#[wasm_bindgen(start)]`,
so it's not recommended to be used in libraries but only end-user
applications. Currently this still must be used with the `crate-type =
["cdylib"]` annotation in `Cargo.toml`.

The implementation here is somewhat tricky because of the circular
dependency between our generated JS and the wasm file that we emit. This
circular dependency makes running initialization routines (like the
`start` shim) particularly fraught with complications because one may
need to run before the other but bundlers may not necessarily respect
it. Workarounds have been implemented for various emission strategies,
for example calling the start function directly after exports are wired
up with `--no-modules` and otherwise working around what appears to be
a Webpack bug with initializers running in a different order than we'd
like. In any case, this in theory doesn't show up to the end user!

Closes #74
2018-11-28 22:11:15 -08:00
..
attribute-fails-to-parse.rs Remove use_extern_macros features 2018-08-19 14:33:01 -07:00
attribute-fails-to-parse.stderr Update syn to 0.15 2018-09-06 15:01:24 -07:00
bad-signatures.rs Remove use_extern_macros features 2018-08-19 14:33:01 -07:00
bad-signatures.stderr Remove use_extern_macros features 2018-08-19 14:33:01 -07:00
Cargo.toml Assert all attributes are used by default 2018-11-28 11:42:48 -08:00
invalid-attr.rs Remove use_extern_macros features 2018-08-19 14:33:01 -07:00
invalid-attr.stderr Update syn to 0.15 2018-09-06 15:01:24 -07:00
invalid-enums.rs Remove use_extern_macros features 2018-08-19 14:33:01 -07:00
invalid-enums.stderr Remove use_extern_macros features 2018-08-19 14:33:01 -07:00
invalid-imports.rs Remove use_extern_macros features 2018-08-19 14:33:01 -07:00
invalid-imports.stderr Remove use_extern_macros features 2018-08-19 14:33:01 -07:00
invalid-items.rs Remove use_extern_macros features 2018-08-19 14:33:01 -07:00
invalid-items.stderr Remove use_extern_macros features 2018-08-19 14:33:01 -07:00
invalid-methods.rs Remove use_extern_macros features 2018-08-19 14:33:01 -07:00
invalid-methods.stderr Remove use_extern_macros features 2018-08-19 14:33:01 -07:00
invalid-setter.rs Improve error message for infer_setter_property 2018-09-21 17:29:50 -07:00
invalid-setter.stderr Support #[wasm_bindgen(setter, js_name = ...)] 2018-09-21 17:54:26 -07:00
non-public-function.rs Remove use_extern_macros features 2018-08-19 14:33:01 -07:00
non-public-function.stderr Remove use_extern_macros features 2018-08-19 14:33:01 -07:00
start-function.rs Add a #[wasm_bindgen(start)] attribute 2018-11-28 22:11:15 -08:00
start-function.stderr Add a #[wasm_bindgen(start)] attribute 2018-11-28 22:11:15 -08:00
structural-and-final.rs Rename host_binding to final 2018-11-09 08:00:41 -08:00
structural-and-final.stderr Rename host_binding to final 2018-11-09 08:00:41 -08:00
test.rs Prepare to have targeted error diagnostics (#604) 2018-08-01 17:15:27 -05:00
unused-attributes.rs Assert all attributes are used by default 2018-11-28 11:42:48 -08:00
unused-attributes.stderr Assert all attributes are used by default 2018-11-28 11:42:48 -08:00
update-all-references.sh Prepare to have targeted error diagnostics (#604) 2018-08-01 17:15:27 -05:00
update-references.sh Prepare to have targeted error diagnostics (#604) 2018-08-01 17:15:27 -05:00