Struct yew::services::KeyboardService [−][src]
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
impl KeyboardService
[src]
impl KeyboardService
[src]pub fn register_key_press<T: AsRef<EventTarget>>(
element: &T,
callback: Callback<KeyboardEvent>
) -> KeyListenerHandle
[src]
pub fn register_key_press<T: AsRef<EventTarget>>(
element: &T,
callback: Callback<KeyboardEvent>
) -> KeyListenerHandle
[src]Registers a callback which 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 the browser compatibility chart in the linked MDN documentation.
pub fn register_key_down<T: AsRef<EventTarget>>(
element: &T,
callback: Callback<KeyboardEvent>
) -> KeyListenerHandle
[src]
pub fn register_key_down<T: AsRef<EventTarget>>(
element: &T,
callback: Callback<KeyboardEvent>
) -> KeyListenerHandle
[src]Registers a callback which listens to KeyDownEvents on a provided element.
Documentation
Note
This browser feature is relatively new and is set to replace the keypress
event.
It may not be fully supported in all browsers.
Consult the browser compatibility chart in the linked MDN documentation.
pub fn register_key_up<T: AsRef<EventTarget>>(
element: &T,
callback: Callback<KeyboardEvent>
) -> KeyListenerHandle
[src]
pub fn register_key_up<T: AsRef<EventTarget>>(
element: &T,
callback: Callback<KeyboardEvent>
) -> KeyListenerHandle
[src]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. It may not be fully supported in all browsers. Consult 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> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Any for T where
T: Any,
[src]
T: Any,