pub struct UseClickOutside {
pub target: NodeRef<Element>,
pub triggered: Signal<bool>,
/* private fields */
}Expand description
Reactive state for a click-outside watcher.
The handle carries the element the hook watches — a NodeRef
the caller attaches to its own markup — and the signal that is
raised when a pointer press lands outside that element.
The watcher listens on the document rather than on the element itself. That is deliberate: the element does not exist while the first render is being built, so a listener attached to it would have nothing to attach to, and a document listener sees the press either way and can then ask whether the pressed node sits inside the watched element.
Fields§
§target: NodeRef<Element>The element the hook watches.
Attach it to the caller’s markup with the ref: attribute.
triggered: Signal<bool>Raised when a press landed outside the watched element.
Implementations§
Source§impl UseClickOutside
Inherent implementation of UseClickOutside.
impl UseClickOutside
Inherent implementation of UseClickOutside.
Source§impl UseClickOutside
impl UseClickOutside
pub fn get_target(&self) -> &NodeRef<Element>
pub fn get_mut_target(&mut self) -> &mut NodeRef<Element>
pub fn set_target(&mut self, val: NodeRef<Element>) -> &mut Self
pub fn get_triggered(&self) -> Signal<bool>
pub fn get_mut_triggered(&mut self) -> &mut Signal<bool>
pub fn set_triggered(&mut self, val: Signal<bool>) -> &mut Self
pub fn get_mut_teardown(&mut self) -> &mut Rc<RefCell<Option<Box<dyn Fn()>>>>
pub fn set_teardown( &mut self, val: Rc<RefCell<Option<Box<dyn Fn()>>>>, ) -> &mut Self
Trait Implementations§
Source§impl Clone for UseClickOutside
impl Clone for UseClickOutside
Source§impl Debug for UseClickOutside
impl Debug for UseClickOutside
Auto Trait Implementations§
impl !RefUnwindSafe for UseClickOutside
impl !Send for UseClickOutside
impl !Sync for UseClickOutside
impl !UnwindSafe for UseClickOutside
impl Freeze for UseClickOutside
impl Unpin for UseClickOutside
impl UnsafeUnpin for UseClickOutside
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more