Skip to content

What is the right way of handling web handles? #151

@notgull

Description

@notgull

I just merged #134, which adds a new web handle type based on references to a JsValue. I opted to merge it now so we can migrate bikeshedding to a new thread.

Three strategies were proposed of having wasm-bindgen-based handles without using the data attribute ID hack:

  • Storing the internal idx u32 field that the JsValue is a wrapper around. While this approach is dependency free and compatible with the current WASM ABI, concerns were voiced that the new API introduced too many footguns, especially for smaller-scale use cases.
  • Storing the JsValue inline. This adds an optional dependency on wasm-bindgen and makes it so window handles can no longer be Copy.
  • Current: Store a pointer that is said to point to a JsValue through a reference. This, again, requires an optional dependency on wasm-bindgen, but makes the handles Copy.

Which strategy should we use to store web handles?

cc @madsmtm @grovesNL @daxpedda

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions