Skip to content

Commit dd2db93

Browse files
authored
Use functions from gloo_utils instead of re-implementing them (#2124)
* Use functions from `gloo_utils` instead of re-implementing them * Remove `anyhow` dependency * fix errors * review + post merge fixes
1 parent 20f76e7 commit dd2db93

File tree

43 files changed

+74
-103
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+74
-103
lines changed

examples/dyn_create_destroy_apps/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ yew = { path = "../../packages/yew" }
1111
slab = "0.4.3"
1212
gloo = "0.3"
1313
wasm-bindgen = "0.2"
14+
gloo-utils = "0.1"
1415

1516
[dependencies.web-sys]
1617
version = "0.3.50"

examples/dyn_create_destroy_apps/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
use gloo_utils::document;
12
use slab::Slab;
23
use web_sys::Element;
34
use yew::prelude::*;
4-
use yew::utils::document;
55

66
mod counter;
77

examples/futures/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ pulldown-cmark = { version = "0.8", default-features = false }
1010
wasm-bindgen = "0.2"
1111
wasm-bindgen-futures = "0.4"
1212
yew = { path = "../../packages/yew" }
13+
gloo-utils = "0.1"
1314

1415
[dependencies.web-sys]
1516
version = "0.3"

examples/futures/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ async fn fetch_markdown(url: &'static str) -> Result<String, FetchError> {
5050

5151
let request = Request::new_with_str_and_init(url, &opts)?;
5252

53-
let window = yew::utils::window();
53+
let window = gloo_utils::window();
5454
let resp_value = JsFuture::from(window.fetch_with_request(&request)).await?;
5555
let resp: Response = resp_value.dyn_into().unwrap();
5656

examples/inner_html/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ license = "MIT OR Apache-2.0"
77

88
[dependencies]
99
yew = { path = "../../packages/yew" }
10+
gloo-utils = "0.1"
1011

1112
[dependencies.web-sys]
1213
version = "0.3"

examples/inner_html/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ impl Component for Model {
1616
}
1717

1818
fn view(&self, _ctx: &Context<Self>) -> Html {
19-
let div = yew::utils::document().create_element("div").unwrap();
19+
let div = gloo_utils::document().create_element("div").unwrap();
2020
div.set_inner_html(HTML);
2121
// See <https://github.com/yewstack/yew/issues/1546>
2222
console::log_1(&div);

examples/mount_point/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ license = "MIT OR Apache-2.0"
88
[dependencies]
99
wasm-bindgen = "0.2"
1010
yew = { path = "../../packages/yew" }
11+
gloo-utils = "0.1"
1112

1213
[dependencies.web-sys]
1314
version = "0.3"

examples/mount_point/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ fn create_canvas(document: &Document) -> HtmlCanvasElement {
6060
}
6161

6262
fn main() {
63-
let document = yew::utils::document();
63+
let document = gloo_utils::document();
6464
let body = document.query_selector("body").unwrap().unwrap();
6565

6666
let canvas = create_canvas(&document);

examples/two_apps/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ license = "MIT OR Apache-2.0"
77

88
[dependencies]
99
yew = { path = "../../packages/yew" }
10+
gloo-utils = "0.1"

examples/two_apps/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl Component for Model {
7070
}
7171

7272
fn mount_app(selector: &'static str) -> AppHandle<Model> {
73-
let document = yew::utils::document();
73+
let document = gloo_utils::document();
7474
let element = document.query_selector(selector).unwrap().unwrap();
7575
yew::start_app_in_element(element)
7676
}

0 commit comments

Comments
 (0)