[−][src]Struct kayrx_ui::fabric::services::keyboard::KeyboardService
Service for registering callbacks on elements to get keystrokes from the user.
Note
Elements that natively support keyboard input (input or textarea) can set an
onkeypress
or oninput
attribute within the html macro. You should use those events instead of
locating the element and registering it with this service.
This service is for adding key event listeners to elements that don't support these attributes,
like the document
or <canvas>
elements for example.
Methods
impl KeyboardService
[src]
pub fn register_key_press<T>(
element: &T,
callback: Callback<KeyboardEvent>
) -> KeyListenerHandle where
T: AsRef<EventTarget>,
[src]
element: &T,
callback: Callback<KeyboardEvent>
) -> KeyListenerHandle where
T: AsRef<EventTarget>,
Registers a callback that listens to KeyPressEvents on a provided element.
Documentation
Warning
This API has been deprecated in the HTML standard and it is not recommended for use in new projects. Consult with the browser compatibility chart in the linked MDN documentation.
pub fn register_key_down<T>(
element: &T,
callback: Callback<KeyboardEvent>
) -> KeyListenerHandle where
T: AsRef<EventTarget>,
[src]
element: &T,
callback: Callback<KeyboardEvent>
) -> KeyListenerHandle where
T: AsRef<EventTarget>,
Registers a callback that listens to KeyDownEvents on a provided element.
Documentation
Note
This browser feature is relatively new and is set to replace keypress events. Not all browsers may support it completely. Consult with the browser compatibility chart in the linked MDN documentation.
pub fn register_key_up<T>(
element: &T,
callback: Callback<KeyboardEvent>
) -> KeyListenerHandle where
T: AsRef<EventTarget>,
[src]
element: &T,
callback: Callback<KeyboardEvent>
) -> KeyListenerHandle where
T: AsRef<EventTarget>,
Registers a callback that listens to KeyUpEvents on a provided element.
Documentation
Note
This browser feature is relatively new and is set to replace keypress events. Not all browsers may support it completely. Consult with the browser compatibility chart in the linked MDN documentation.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for KeyboardService
impl Send for KeyboardService
impl Sync for KeyboardService
impl Unpin for KeyboardService
impl UnwindSafe for KeyboardService
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Any for T where
T: Any,
T: Any,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,