Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 51 additions & 36 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 9 additions & 11 deletions example-web/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
[package]
name = "whoami_web"
edition = "2021"
rust-version = "1.75"

[lib]
crate-type = ["cdylib", "rlib"]

[features]
default = ["console_error_panic_hook"]

# The `console_error_panic_hook` crate provides better debugging of panics by
# logging them with `console.error`. This is great for development, but requires
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
# code size when deploying.
[dependencies.console_error_panic_hook]
version = "0.1.7"
# The web panic hook crate provides a visual display during panics
[dependencies.web_panic_hook]
version = "0.1.0"
optional = true

# wasm-bindgen lets us export our main function to the javascript that runs the
# web assembly module.
[dependencies.wasm-bindgen]
version = "0.2.100"
version = "0.2.117"

# The `web-sys` crate lets us log in the web console.
[dependencies.web-sys]
version = "0.3.77"
version = "0.3.94"
features = ["console"]

# `whoami` - the crate we're testing!
[dependencies.whoami]
path = "../whoami"

[features]
default = ["web_panic_hook"]
8 changes: 4 additions & 4 deletions example-web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
## Install `wasm-pack` and `http`
```bash
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
cargo install https
cargo install simple-http-server --locked
```

## Build & Run Web Server
```bash
wasm-pack build --target web && http .
wasm-pack build --target web && simple-http-server .
```

Now, open http://localhost:8000/ in your web browser and check the javascript
console.
Now, open http://localhost:8000/index.html in your web browser and check the
javascript console.
4 changes: 2 additions & 2 deletions example-web/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ pub fn main() {
//
// For more details see
// https://github.com/rustwasm/console_error_panic_hook#readme
#[cfg(feature = "console_error_panic_hook")]
console_error_panic_hook::set_once();
#[cfg(feature = "web_panic_hook")]
std::panic::set_hook(Box::new(web_panic_hook::hook));

// Print out code from regular example.
log(format!(
Expand Down
4 changes: 2 additions & 2 deletions whoami/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ default-features = false

# Target-specific dependency for unix-like
[target.'cfg(all(any(target_vendor = "apple", target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd", target_os = "illumos", target_os = "hurd"), not(target_arch = "wasm32")))'.dependencies.libc]
version = "0.2.186"
version = "0.2.190"
optional = true
features = []
default-features = false
Expand All @@ -55,7 +55,7 @@ default-features = false

# Target-specific dependency for web browser
[target.'cfg(all(target_arch = "wasm32", not(target_os = "wasi"), not(daku)))'.dependencies.web-sys]
version = "0.3.85"
version = "0.3.94"
optional = true
features = ["Navigator", "Document", "Window", "Location"]
default-features = false
Expand Down
Loading