pub struct KeyboardService {}
Expand description
Service for registering callbacks on elements to get keystrokes from the user.
§Note
Elements which natively support keyboard input (such as <input/>
or <textarea/>
) can use the
onkeypress
or oninput
attributes from within the html macro. You should use those events
instead of locating the element and registering an event listener using this service.
This service is for adding key event listeners to elements which don’t support these attributes,
(for example the document
and <canvas>
elements).
Implementations§
Source§impl KeyboardService
impl KeyboardService
Sourcepub fn register_key_press<T: IEventTarget>(
element: &T,
callback: Callback<KeyPressEvent>,
) -> KeyListenerHandle
pub fn register_key_press<T: IEventTarget>( element: &T, callback: Callback<KeyPressEvent>, ) -> KeyListenerHandle
Sourcepub fn register_key_down<T: IEventTarget>(
element: &T,
callback: Callback<KeyDownEvent>,
) -> KeyListenerHandle
pub fn register_key_down<T: IEventTarget>( element: &T, callback: Callback<KeyDownEvent>, ) -> KeyListenerHandle
Sourcepub fn register_key_up<T: IEventTarget>(
element: &T,
callback: Callback<KeyUpEvent>,
) -> KeyListenerHandle
pub fn register_key_up<T: IEventTarget>( element: &T, callback: Callback<KeyUpEvent>, ) -> KeyListenerHandle
Trait Implementations§
Auto Trait Implementations§
impl Freeze for KeyboardService
impl RefUnwindSafe for KeyboardService
impl Send for KeyboardService
impl Sync for KeyboardService
impl Unpin for KeyboardService
impl UnwindSafe for KeyboardService
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, V> IntoOptPropValue<V> for Twhere
T: IntoPropValue<Option<V>>,
impl<T, V> IntoOptPropValue<V> for Twhere
T: IntoPropValue<Option<V>>,
Source§fn into_opt_prop_value(self) -> Option<V>
fn into_opt_prop_value(self) -> Option<V>
Convert
self
to an optional value of a Properties
struct.Source§impl<T> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
Source§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
Convert
self
to a value of a Properties
struct.Source§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
Source§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
Convert
self
to a value of a Properties
struct.