pub fn lifecycle<A: Clone + 'static>(f: impl Fn() -> Dom + 'static) -> impl FnOnce(DomBuilder<A>) -> DomBuilder<A>
    {
        let keep_alive = Rc::new(RefCell::new(Some(Self::new(f))));

        clone!(keep_alive => move |dom| {
            dom
                .after_removed(clone!(keep_alive => move |_| {
                    let _ = keep_alive.borrow_mut().take();
                }))
        })

    }
/// the usual way. meant to be passed to some parent's .apply()
/// will tie this handle to the lifecycle of the parent
the usual way. meant to be passed to some parent's .apply()
will tie this handle to the lifecycle of the parent
the usual way . meant to be passed to some parent ' s . apply () will tie this handle to the lifecycle of the parent
pub fn lifecycle<A: Clone + 'static>(f: impl Fn() -> Dom + 'static) -> impl FnOnce(DomBuilder<A>) -> DomBuilder<A>
    {
        let keep_alive = Rc::new(RefCell::new(Some(Self::new(f))));
        clone!(keep_alive => move |dom| {
            dom
                .after_removed(clone!(keep_alive => move |_| {
                    let _ = keep_alive.borrow_mut().take();
                }))
        })
    }
pub fn lifecycle < A : Clone + ' static > ( f : impl Fn ( ) -> Dom + ' static ) -> impl FnOnce ( DomBuilder < A > ) -> DomBuilder < A > { let keep_alive = Rc :: new ( RefCell :: new ( Some ( Self :: new ( f ) ) ) ) ; clone ! ( keep_alive move dom { dom after_removed ( clone ( keep_alive move { let keep_alive borrow_mut ( ) take ( ) } ) ) } ) }
the usual way.
the usual way .
f
impl Fn() -> Dom + 'static
f
impl Fn() -> Dom + 'static