Avoid leaking implementation details in Canvas API
This commit is contained in:
parent
8f66d96915
commit
1596cc5d9e
7 changed files with 56 additions and 986 deletions
|
|
@ -220,5 +220,8 @@ pub fn keyboard_modifiers(event: &KeyboardEvent) -> ModifiersState {
|
|||
}
|
||||
|
||||
pub fn codepoint(event: &KeyboardEvent) -> char {
|
||||
// `event.key()` always returns a non-empty `String`. Therefore, this should
|
||||
// never panic.
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key
|
||||
event.key().chars().next().unwrap()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue