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

Browser Support? #99

Closed
zicklag opened this issue Mar 9, 2023 · 3 comments
Closed

Browser Support? #99

zicklag opened this issue Mar 9, 2023 · 3 comments

Comments

@zicklag
Copy link

zicklag commented Mar 9, 2023

Hey there! Would you be open to supporting browsers behind a feature flag that uses wasm-bindgen?

@complexspaces
Copy link
Collaborator

Hey there,

I'm not particularly opposed to inclusion of browser support, but I do have a few questions about how it would be implemented based off my current knowledge of JS/Rust interoperability:

  • How will users deal with the requirement of --cfg=web_sys_unstable_apis being provided to via RUSTFLAGS to access the relevant APIs in web-sys?
  • What is the plan to handle the inherent async nature of everything that calls into browser APIs? As it is today, the whole crate has a synchronous API.

@daxpedda
Copy link
Contributor

daxpedda commented Mar 9, 2023

  • How will users deal with the requirement of --cfg=web_sys_unstable_apis being provided to via RUSTFLAGS to access the relevant APIs in web-sys?

This can be circumvented by not relying on web-sys but wasm-bindgen and just defining your own imports that are not gated behind --cfg=web_sys_unstable_apis.

  • What is the plan to handle the inherent async nature of everything that calls into browser APIs? As it is today, the whole crate has a synchronous API.

Ultimately I think this is gonna be the dealbreaker. There is a synchronous API for writing to the clipboard: execCommand('copy'). But it doesn't really work the way we need it to.

@zicklag
Copy link
Author

zicklag commented Mar 9, 2023

Ultimately I think this is gonna be the dealbreaker. There is a synchronous API for writing to the clipboard: execCommand('copy'). But it doesn't really work the way we need it to.

Ah, bummer. I didn't think about the async nature. In my use-case it didn't really matter because I could set or get the clipboard as an async call and just not wait for the promise to finish.

But for users who use the native API and expect it to behave the same, that would be confusing if they couldn't set the clipboard and have an immediate read reflect the new clipboard contents when on web.

For now I'll just workaround in my app with WASM bindgen. Thanks for the replies!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants