Add Web platform helpers for browser, mobile detection and timezone#193
Add Web platform helpers for browser, mobile detection and timezone#193ilaria1903 wants to merge 2 commits intoardaku:v2from
Conversation
| - updated `example-web/index.html` | ||
| - updated `whoami/Cargo.toml` | ||
| - updated `whoami/src/os/web.rs` | ||
| - updated `Cargo.lock` |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
Rather than use the old version of this crate, can you use yansi 1.0.1?
| @@ -0,0 +1,18 @@ | |||
| use colored::*; | |||
There was a problem hiding this comment.
You will need to run cargo +nightly fmt so that CI passes
| } | ||
|
|
||
| #[wasm_bindgen] | ||
| pub fn is_mobile() -> bool { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
I don't want to add this only for web. Can this be separated to its own PR?
|
|
||
|
|
||
| #[wasm_bindgen] | ||
| pub fn browser() -> String { |
There was a problem hiding this comment.
There's already code for getting the browser name in whoami:
https://github.com/ardaku/whoami/blob/v2/WASM.md#web-browser
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
whoami/examples/greeter.rsexample-web/index.htmlwhoami/Cargo.tomlwhoami/src/os/web.rs