Struct leptos_dom::ev::Custom
source · pub struct Custom<E: FromWasmAbi = Event> { /* private fields */ }
Expand description
A custom event.
Implementations§
source§impl<E: FromWasmAbi> Custom<E>
impl<E: FromWasmAbi> Custom<E>
sourcepub fn new(name: impl Into<Oco<'static, str>>) -> Self
pub fn new(name: impl Into<Oco<'static, str>>) -> Self
Creates a custom event type that can be used within
HtmlElement::on
, for events
which are not covered in the ev
module.
sourcepub fn options_mut(&mut self) -> &mut AddEventListenerOptions
pub fn options_mut(&mut self) -> &mut AddEventListenerOptions
Modify the AddEventListenerOptions
used for this event listener.
let mut non_passive_wheel = ev::Custom::<ev::WheelEvent>::new("wheel");
let options = non_passive_wheel.options_mut();
options.passive(false);
canvas_ref.on_load(move |canvas: HtmlElement<html::Canvas>| {
canvas.on(non_passive_wheel, move |_event| {
// Handle _event
});
});
Trait Implementations§
source§impl<E: FromWasmAbi> Clone for Custom<E>
impl<E: FromWasmAbi> Clone for Custom<E>
source§impl<E: FromWasmAbi> EventDescriptor for Custom<E>
impl<E: FromWasmAbi> EventDescriptor for Custom<E>
Auto Trait Implementations§
impl<E> Freeze for Custom<E>
impl<E> RefUnwindSafe for Custom<E>where
E: RefUnwindSafe,
impl<E = Event> !Send for Custom<E>
impl<E = Event> !Sync for Custom<E>
impl<E> Unpin for Custom<E>where
E: Unpin,
impl<E> UnwindSafe for Custom<E>where
E: UnwindSafe,
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more