[][src]Struct seed::virtual_dom::event_handler_manager::EventHandlerManager

pub struct EventHandlerManager<Ms> { /* fields omitted */ }

Manages event handlers and listeners for elements.

Methods

impl<Ms> EventHandlerManager<Ms>[src]

pub fn new() -> Self[src]

Creates an empty manager instance.

pub fn with_event_handlers(event_handlers: Vec<EventHandler<Ms>>) -> Self[src]

Creates a new manager instance with given event handlers. It doesn't create listeners automatically - you have to call attach_listeners.

pub fn attach_listeners(
    &mut self,
    event_target: impl Into<EventTarget> + 'static,
    old_manager: Option<&mut EventHandlerManager<Ms>>,
    mailbox: &Mailbox<Ms>
)
[src]

Creates missing listeners and attaches them to the given event_target. It can reuse listeners from the old_manager.

pub fn add_event_handlers(&mut self, event_handlers: Vec<EventHandler<Ms>>)[src]

Add new event handlers into the manager. It doesn't create listeners automatically - you have to call attach_listeners.

pub fn take_and_setup_listener(
    &mut self,
    trigger: &Ev,
    event_handlers: Rc<RefCell<Vec<EventHandler<Ms>>>>
) -> Option<Listener<Ms>>
[src]

This method is used in attach_listeners method to move listeners from the old manager.

Trait Implementations

impl<Ms> Clone for EventHandlerManager<Ms>[src]

impl<Ms: Debug> Debug for EventHandlerManager<Ms>[src]

impl<Ms: Default> Default for EventHandlerManager<Ms>[src]

impl<Ms: 'static, OtherMs: 'static> MessageMapper<Ms, OtherMs> for EventHandlerManager<Ms>[src]

type SelfWithOtherMs = EventHandlerManager<OtherMs>

fn map_msg(
    self,
    f: impl FnOnce(Ms) -> OtherMs + 'static + Clone
) -> EventHandlerManager<OtherMs>
[src]

Note: Listeners will be automatically detached and removed. You have to call attach_listeners to recreate them.

Auto Trait Implementations

impl<Ms> !RefUnwindSafe for EventHandlerManager<Ms>

impl<Ms> !Send for EventHandlerManager<Ms>

impl<Ms> !Sync for EventHandlerManager<Ms>

impl<Ms> Unpin for EventHandlerManager<Ms>

impl<Ms> !UnwindSafe for EventHandlerManager<Ms>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.