Skip to content

Commit

Permalink
Agent v2 (#2773)
Browse files Browse the repository at this point in the history
* Make private bridges.

* Add worker agent.

* Add task type.

* Memorised Task.

* Add station.

* Add Station Agent.

* Subscription.

* Station hooks.

* Reactor Agents.

* Add more description.

* Restart station when closed.

* Remove Station restart.

* Send finish message to bridges.

* Adds a method to read whether a bridge has received finish message for a subscription.

* Update Reactor Agent.

* Decouple macros from it.

* Reactor Macro.

* Reactivate Task.

* Slightly adjust API.

* Add documentation for reactor agents.

* Remove Station.

* Create Task macro.

* Migrate Example.

* Simplify Task Agent Design.

* Implement Sink.

* Agent -> Task in Example.

* Switch to Registrable.

* AgentScopeExt.

* Finish AgentScopeExt.

* Prelude.

* Adjust prelude.

* Fix imports.

* Yew Agent.

* Switch to upstreamed version of gloo.

* Add stub reset.

* Remove example.

* Add Reset for Worker agents.

* merge fix-ci into "agent-v2"

* Switch to released version of gloo.

* Adds Runtime.

* A LocalRuntime.

* Add note.

* Add SSR benchmark.

* Only create default runtime if no custom runtime is set.

* Use jemalloc for benchmarking.

* Remove once_cell for web assembly.

* Add time.

* Fix wasm_bindgen.

* Adjust inlining.

* merge local-runtime into "agent-v2"

* Add reset.

* Simplify task agent.

* SSR for tasks.

* Optimise benchmark output.

* Optimise BufWriter.

* Add json output.

* Add Benchmark Workflow.

* merge local-runtime into "agent-v2"

* Makes Prepared States to be Rc'ed.

* Move example.

* Update example.

* Implement prepared state for memorised tasks.

* Make prepared states work on none runtime as well.

* Finished prepared output.

* Remove local set from tests.

* Fix Workflow syntax.

* Exclude benchmark from doc tests.

* Tidy up the code.

* Remove HashSet.

* Fix rustfmt.

* Some optimisation.

* Use postcard.

* Remove allocations.

* Weak Ref.

* Adjust feature flags.

* Adds a pinned channel implementation.

* Make Send bound explicit.

* Migrate to pinned channel.

* Implement on immutable reference.

* Rename agent channel method.

* Fix Sink close.

* Fix closing.

* Remove old platform.

* Migrate to new macro.

* Port Oneshot Agent.

* Migrate reactor to gloo-worker.

* Implement ScopeExt for Reactor.

* Remove unneeded checks.

* Update example note.

* Fix doc tests.

* Add an example for reactor agent.

* Rename Prime to PrimeReactor.

* Update Crate Information.

* Remove unused dependencies.

* Remove unused dependencies.

* Update documentation.

* Rename Bridge to Runner.

* Update documentation.

* Update documentation.

* Update State name.

* Merge outputs state for subscriptions.

* Update documentation.

* Fix doc link.

* Make code link code link.

* Make CODEC -> C.

* Update Debug Implementation to type_name.

* Fix readme.
  • Loading branch information
futursolo committed Sep 18, 2023
1 parent 73f4bb9 commit eec0758
Show file tree
Hide file tree
Showing 35 changed files with 2,442 additions and 269 deletions.
163 changes: 155 additions & 8 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ As an example, check out the TodoMVC example here: <https://examples.yew.rs/todo
| [timer_functional](timer_functional) | [F] | Demonstrates the use of the interval and timeout services using function components |
| [todomvc](todomvc) | [S] | Implementation of [TodoMVC](http://todomvc.com/). |
| [two_apps](two_apps) | [S] | Runs two separate Yew apps which can communicate with each other. |
| [web_worker_fib](web_worker_fib) | [S] | Calculate Fibonacci numbers in a web worker thread using [`gloo-worker`](https://docs.rs/gloo-worker/latest/gloo_worker/). |
| [web_worker_fib](web_worker_fib) | [F] | Calculate Fibonacci numbers in a web worker thread using [`yew-agent`](https://docs.rs/yew-agent/latest/yew_agent/). |
| [web_worker_prime](web_worker_prime) | [F] | Calculate Prime numbers in a web worker thread using [`yew-agent`](https://docs.rs/yew-agent/latest/yew_agent/). |
| [webgl](webgl) | [S] | Controls a [WebGL canvas](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Getting_started_with_WebGL) from Yew. |

[CT]: ## "Component Type"
Expand Down
3 changes: 2 additions & 1 deletion examples/web_worker_fib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ yew-agent = { path = "../../packages/yew-agent" }
wasm-bindgen = "0.2"
js-sys = "0.3"
web-sys = { version = "0.3", features = [ "HtmlInputElement" ] }
serde = "1"
serde = { version = "1", features = ["derive"] }
postcard = "1.0.0"
2 changes: 1 addition & 1 deletion examples/web_worker_fib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Calculate fibrillation value of a number in the worker thread, without blocking

## Concepts

The example illustrates how to use `gloo-worker` to send tasks to a worker thread in a Yew application.
The example illustrates how to use `yew-agent` to send tasks to a worker thread in a Yew application.

## Thanks to

Expand Down
14 changes: 8 additions & 6 deletions examples/web_worker_fib/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="utf-8">
<title>Yew • Web Worker Fibonacci</title>
<title>Yew • Web Worker Fibonacci</title>

<link data-trunk rel="rust" href="Cargo.toml" data-bin="app" data-type="main" data-weak-refs />
<link data-trunk rel="rust" href="Cargo.toml" data-bin="worker" data-type="worker" data-weak-refs />
</head>

<link data-trunk rel="rust" href="Cargo.toml" data-bin="app" data-type="main" />
<link data-trunk rel="rust" href="Cargo.toml" data-bin="worker" data-type="worker" />
</head>
<body>
</body>

<body>
</body>
</html>

0 comments on commit eec0758

Please sign in to comment.