Skip to content

Rename fn to main_js in guide/src/reference/attributes/on-rust-exports/start.md #2207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion guide/src/reference/attributes/on-rust-exports/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ soon as the wasm module is instantiated.

```rust
#[wasm_bindgen(start)]
pub fn main() {
pub fn main_js() {
// executed automatically ...
}
```
Expand All @@ -21,6 +21,7 @@ There's a few caveats to be aware of when using the `start` attribute:

* The `start` function must take no arguments and must either return `()` or
`Result<(), JsValue>`
* The name of the annotated function can't be `main`
* Only one `start` function can be placed into a module, including its
dependencies. If more than one is specified then `wasm-bindgen` will fail when
the CLI is run. It's recommended that only applications use this attribute.
Expand Down