Skip to content

Commit 92904ce

Browse files
refactor: un-vendor gloo-worker from yew-agent (#4106)
gloo-worker 0.6.0 now ships with module worker type support (the `as_module()` method on all spawners), which was the reason we vendored it in the first place.
1 parent 3b90320 commit 92904ce

33 files changed

Lines changed: 86 additions & 1950 deletions

Cargo.lock

Lines changed: 65 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/yew-agent/Cargo.toml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,11 @@ rust-version = "1.84.0"
1313

1414
[dependencies]
1515
yew = { version = "0.23.0", path = "../yew" }
16+
gloo-worker = { version = "0.6", features = ["futures"] }
1617
wasm-bindgen.workspace = true
17-
js-sys.workspace = true
18-
pinned = "0.1.0"
19-
thiserror.workspace = true
20-
bincode = { workspace = true }
21-
wasm-bindgen-futures.workspace = true
2218
serde = { workspace = true, features = ["derive"] }
2319
futures.workspace = true
2420
yew-agent-macro = { version = "0.4", path = "../yew-agent-macro" }
2521

26-
[dependencies.web-sys]
27-
workspace = true
28-
features = [
29-
"Blob",
30-
"BlobPropertyBag",
31-
"DedicatedWorkerGlobalScope",
32-
"MessageEvent",
33-
"Url",
34-
"Worker",
35-
"WorkerOptions",
36-
"WorkerType"
37-
]
38-
3922
[dev-dependencies]
4023
serde = { workspace = true }

packages/yew-agent/src/codec.rs

Lines changed: 0 additions & 43 deletions
This file was deleted.

packages/yew-agent/src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@
1010

1111
extern crate self as yew_agent;
1212

13-
pub mod codec;
1413
pub mod oneshot;
1514
pub mod reactor;
1615
pub mod worker;
17-
pub use codec::{Bincode, Codec};
18-
pub mod traits;
19-
pub use traits::{Registrable, Spawnable};
16+
17+
#[doc(inline)]
18+
pub use gloo_worker::{Bincode, Codec, Registrable, Spawnable};
2019

2120
mod reach;
2221
pub mod scope_ext;

packages/yew-agent/src/oneshot/bridge.rs

Lines changed: 0 additions & 73 deletions
This file was deleted.
Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
//! This module provides task agent implementation.
22
3-
mod bridge;
43
mod hooks;
54
mod provider;
6-
mod registrar;
7-
mod spawner;
8-
mod traits;
9-
mod worker;
105

11-
pub use bridge::OneshotBridge;
6+
#[doc(inline)]
7+
pub use gloo_worker::oneshot::{Oneshot, OneshotBridge, OneshotRegistrar, OneshotSpawner};
128
pub use hooks::{use_oneshot_runner, UseOneshotRunnerHandle};
139
pub use provider::OneshotProvider;
1410
pub(crate) use provider::OneshotProviderState;
15-
pub use registrar::OneshotRegistrar;
16-
pub use spawner::OneshotSpawner;
17-
pub use traits::Oneshot;
1811
/// A procedural macro to create oneshot agents.
1912
pub use yew_agent_macro::oneshot;

packages/yew-agent/src/oneshot/provider.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ use std::any::type_name;
33
use std::cell::RefCell;
44
use std::rc::Rc;
55

6+
use gloo_worker::{Bincode, Codec};
67
use serde::{Deserialize, Serialize};
78
use yew::prelude::*;
89

910
use super::{Oneshot, OneshotBridge, OneshotSpawner};
1011
use crate::utils::get_next_id;
1112
use crate::worker::WorkerProviderProps;
12-
use crate::{Bincode, Codec, Reach};
13+
use crate::Reach;
1314

1415
pub(crate) struct OneshotProviderState<T>
1516
where

0 commit comments

Comments
 (0)