Skip to content

Add Web platform helpers for browser, mobile detection and timezone#193

Open
ilaria1903 wants to merge 2 commits intoardaku:v2from
ilaria1903:ilaria-first-contribution
Open

Add Web platform helpers for browser, mobile detection and timezone#193
ilaria1903 wants to merge 2 commits intoardaku:v2from
ilaria1903:ilaria-first-contribution

Conversation

@ilaria1903
Copy link

Add web improvements and new Rust example (first contribution)

<!### Summary

This pull request adds my first contribution to the project.
I added a small Rust example and improved parts of the web demo UI.

Changes

  • added new Rust example: whoami/examples/greeter.rs
  • updated example-web/index.html
  • updated whoami/Cargo.toml
  • updated whoami/src/os/web.rs

- updated `example-web/index.html`
- updated `whoami/Cargo.toml`
- updated `whoami/src/os/web.rs`
- updated `Cargo.lock`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file's changes should be reverted. This is the template that populates the PR description.

unexpected_cfgs = { level = "allow", check-cfg = ['cfg(daku)'] }

[dependencies]
colored = "2.0.4"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than use the old version of this crate, can you use yansi 1.0.1?

@@ -0,0 +1,18 @@
use colored::*;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will need to run cargo +nightly fmt so that CI passes

}

#[wasm_bindgen]
pub fn is_mobile() -> bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're adding mobile detection, it should be added as a method on https://docs.rs/whoami/2.0.0-pre.3/whoami/enum.Platform.html

}

#[wasm_bindgen]
pub fn timezone() -> String {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to add this only for web. Can this be separated to its own PR?



#[wasm_bindgen]
pub fn browser() -> String {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's already code for getting the browser name in whoami:

https://github.com/ardaku/whoami/blob/v2/WASM.md#web-browser

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.

2 participants