-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from jamsocket/paulgb/add-aper-leptos
Add aper-leptos
- Loading branch information
Showing
10 changed files
with
1,334 additions
and
315 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[package] | ||
name = "aper-leptos" | ||
version = "0.5.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
aper = {path = "../aper"} | ||
aper-websocket-client = { version="0.5.0", path="../aper-websocket-client" } | ||
leptos = { version = "0.6.14", features = ["csr"] } | ||
serde = "1.0.210" | ||
tracing-subscriber = "0.3.18" | ||
tracing-web = "0.1.3" |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use aper::{data_structures::Atom, AperSync}; | ||
use leptos::{create_signal, ReadSignal, SignalSet}; | ||
use serde::{de::DeserializeOwned, Serialize}; | ||
|
||
pub mod init_tracing; | ||
|
||
pub trait Watch<T> { | ||
fn watch(&self) -> ReadSignal<T>; | ||
} | ||
|
||
impl<T> Watch<T> for Atom<T> | ||
where | ||
T: Serialize + DeserializeOwned + Default + Clone + Send + Sync + 'static, | ||
{ | ||
fn watch(&self) -> ReadSignal<T> { | ||
let (signal, set_signal) = create_signal(self.get()); | ||
|
||
let self_clone = self.clone(); | ||
self.listen(move || { | ||
set_signal.set(self_clone.get()); | ||
true | ||
}); | ||
|
||
signal | ||
} | ||
} |
Oops, something went wrong.