Skip to content
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

Allow for js property inspection #1876

Merged
merged 4 commits into from
Nov 26, 2019
Merged

Allow for js property inspection #1876

merged 4 commits into from
Nov 26, 2019

Commits on Nov 24, 2019

  1. Add support for #[wasm_bindgen(inspectable)]

    This annotation generates a `toJSON` and `toString` implementation for
    generated JavaScript classes which display all readable properties
    available via the class or its getters
    
    This is useful because wasm-bindgen classes currently serialize to
    display one value named `ptr`, which does not model the properties of
    the struct in Rust
    
    This annotation addresses #1857
    codehearts committed Nov 24, 2019
    Configuration menu
    Copy the full SHA
    78e7c99 View commit details
    Browse the repository at this point in the history
  2. Support console.log for inspectable attr in Nodejs

    `#[wasm_bindgen(inspectable)]` now generates an implementation of
    `[util.inspect.custom]` for the Node.js target only. This implementation
    causes `console.log` and friends to yield the same class-style output,
    but with all readable fields of the Rust struct displayed
    codehearts committed Nov 24, 2019
    Configuration menu
    Copy the full SHA
    8929eef View commit details
    Browse the repository at this point in the history

Commits on Nov 26, 2019

  1. Reduce duplication in generated methods

    Generated `toString` and `[util.inspect.custom]` methods now call
    `toJSON` to reduce duplication
    codehearts committed Nov 26, 2019
    Configuration menu
    Copy the full SHA
    42a5571 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    28c8267 View commit details
    Browse the repository at this point in the history