Skip to content

Commit

Permalink
Add new funcs for RwSignal and Trigger (lapce#312)
Browse files Browse the repository at this point in the history
* Add new funcs for RwSignal and Trigger

* make clippy happy
  • Loading branch information
jrmoulton committed Mar 3, 2024
1 parent c7df2e2 commit f4ad499
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions reactive/src/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ impl<T> RwSignal<T> {
}
}
}
impl<T: 'static> RwSignal<T> {
pub fn new(value: T) -> Self {
create_rw_signal(value)
}
}

impl<T: Clone> RwSignal<T> {
/// Clones and returns the current value stored in the Signal, and subcribes
Expand Down
5 changes: 5 additions & 0 deletions reactive/src/trigger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ impl Trigger {
pub fn track(&self) {
self.signal.with(|_| {});
}

#[allow(clippy::new_without_default)]
pub fn new() -> Self {
create_trigger()
}
}

pub fn create_trigger() -> Trigger {
Expand Down

0 comments on commit f4ad499

Please sign in to comment.