Skip to content

Add support for web_sys in addition to stdweb#4

Open
Stigjb wants to merge 4 commits into
yewstack:masterfrom
stigjb-forks:web-sys-support
Open

Add support for web_sys in addition to stdweb#4
Stigjb wants to merge 4 commits into
yewstack:masterfrom
stigjb-forks:web-sys-support

Conversation

@Stigjb
Copy link
Copy Markdown

@Stigjb Stigjb commented May 2, 2020

This crate depended on stdweb, which is not desirable if you prefer to use web-sys, like the main Yew project is moving to.

Many of the examples in the Yew project depend on web_logger, and therefore implicitly pull in stdweb even though they're supposed to be web-sys only. I assume they will benefit from smaller code size once web_logger can use web-sys as well.

  • Updated to Rust 2018 edition (no extern crate or macro_use)
  • Use a stdweb- or web-sys-based module based on the selected feature
  • std_web as default feature to keep backward compatibility

Some diffs are entirely cargo fmts doing.

Questions

I'm not confident that I applied pub(super) right in the respective modules, but I tried to mirror the original.

I think it would be nice to provide a warning if someone were to try to install both features (which could happen if they forgot default-features = false). Not sure how to do that. Because of the order of cfg_if, this would build the std_web module.

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

Successfully merging this pull request may close these issues.

1 participant