maxcountryman_web_sys/features/
gen_KeyboardEvent.rs

1#![allow(unused_imports)]
2use super::*;
3use wasm_bindgen::prelude::*;
4#[wasm_bindgen]
5extern "C" {
6    # [wasm_bindgen (extends = UiEvent , extends = Event , extends = :: js_sys :: Object , js_name = KeyboardEvent , typescript_type = "KeyboardEvent")]
7    #[derive(Debug, Clone, PartialEq, Eq)]
8    #[doc = "The `KeyboardEvent` class."]
9    #[doc = ""]
10    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent)"]
11    #[doc = ""]
12    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`*"]
13    pub type KeyboardEvent;
14    # [wasm_bindgen (structural , method , getter , js_class = "KeyboardEvent" , js_name = charCode)]
15    #[doc = "Getter for the `charCode` field of this object."]
16    #[doc = ""]
17    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/charCode)"]
18    #[doc = ""]
19    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`*"]
20    pub fn char_code(this: &KeyboardEvent) -> u32;
21    # [wasm_bindgen (structural , method , getter , js_class = "KeyboardEvent" , js_name = keyCode)]
22    #[doc = "Getter for the `keyCode` field of this object."]
23    #[doc = ""]
24    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode)"]
25    #[doc = ""]
26    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`*"]
27    pub fn key_code(this: &KeyboardEvent) -> u32;
28    # [wasm_bindgen (structural , method , getter , js_class = "KeyboardEvent" , js_name = altKey)]
29    #[doc = "Getter for the `altKey` field of this object."]
30    #[doc = ""]
31    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/altKey)"]
32    #[doc = ""]
33    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`*"]
34    pub fn alt_key(this: &KeyboardEvent) -> bool;
35    # [wasm_bindgen (structural , method , getter , js_class = "KeyboardEvent" , js_name = ctrlKey)]
36    #[doc = "Getter for the `ctrlKey` field of this object."]
37    #[doc = ""]
38    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/ctrlKey)"]
39    #[doc = ""]
40    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`*"]
41    pub fn ctrl_key(this: &KeyboardEvent) -> bool;
42    # [wasm_bindgen (structural , method , getter , js_class = "KeyboardEvent" , js_name = shiftKey)]
43    #[doc = "Getter for the `shiftKey` field of this object."]
44    #[doc = ""]
45    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/shiftKey)"]
46    #[doc = ""]
47    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`*"]
48    pub fn shift_key(this: &KeyboardEvent) -> bool;
49    # [wasm_bindgen (structural , method , getter , js_class = "KeyboardEvent" , js_name = metaKey)]
50    #[doc = "Getter for the `metaKey` field of this object."]
51    #[doc = ""]
52    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/metaKey)"]
53    #[doc = ""]
54    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`*"]
55    pub fn meta_key(this: &KeyboardEvent) -> bool;
56    # [wasm_bindgen (structural , method , getter , js_class = "KeyboardEvent" , js_name = location)]
57    #[doc = "Getter for the `location` field of this object."]
58    #[doc = ""]
59    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/location)"]
60    #[doc = ""]
61    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`*"]
62    pub fn location(this: &KeyboardEvent) -> u32;
63    # [wasm_bindgen (structural , method , getter , js_class = "KeyboardEvent" , js_name = repeat)]
64    #[doc = "Getter for the `repeat` field of this object."]
65    #[doc = ""]
66    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat)"]
67    #[doc = ""]
68    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`*"]
69    pub fn repeat(this: &KeyboardEvent) -> bool;
70    # [wasm_bindgen (structural , method , getter , js_class = "KeyboardEvent" , js_name = isComposing)]
71    #[doc = "Getter for the `isComposing` field of this object."]
72    #[doc = ""]
73    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/isComposing)"]
74    #[doc = ""]
75    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`*"]
76    pub fn is_composing(this: &KeyboardEvent) -> bool;
77    # [wasm_bindgen (structural , method , getter , js_class = "KeyboardEvent" , js_name = key)]
78    #[doc = "Getter for the `key` field of this object."]
79    #[doc = ""]
80    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)"]
81    #[doc = ""]
82    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`*"]
83    pub fn key(this: &KeyboardEvent) -> String;
84    # [wasm_bindgen (structural , method , getter , js_class = "KeyboardEvent" , js_name = code)]
85    #[doc = "Getter for the `code` field of this object."]
86    #[doc = ""]
87    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code)"]
88    #[doc = ""]
89    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`*"]
90    pub fn code(this: &KeyboardEvent) -> String;
91    #[wasm_bindgen(catch, constructor, js_class = "KeyboardEvent")]
92    #[doc = "The `new KeyboardEvent(..)` constructor, creating a new instance of `KeyboardEvent`."]
93    #[doc = ""]
94    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)"]
95    #[doc = ""]
96    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`*"]
97    pub fn new(type_arg: &str) -> Result<KeyboardEvent, JsValue>;
98    #[cfg(feature = "KeyboardEventInit")]
99    #[wasm_bindgen(catch, constructor, js_class = "KeyboardEvent")]
100    #[doc = "The `new KeyboardEvent(..)` constructor, creating a new instance of `KeyboardEvent`."]
101    #[doc = ""]
102    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)"]
103    #[doc = ""]
104    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`, `KeyboardEventInit`*"]
105    pub fn new_with_keyboard_event_init_dict(
106        type_arg: &str,
107        keyboard_event_init_dict: &KeyboardEventInit,
108    ) -> Result<KeyboardEvent, JsValue>;
109    # [wasm_bindgen (method , structural , js_class = "KeyboardEvent" , js_name = getModifierState)]
110    #[doc = "The `getModifierState()` method."]
111    #[doc = ""]
112    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState)"]
113    #[doc = ""]
114    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`*"]
115    pub fn get_modifier_state(this: &KeyboardEvent, key: &str) -> bool;
116    # [wasm_bindgen (catch , method , structural , js_class = "KeyboardEvent" , js_name = initKeyboardEvent)]
117    #[doc = "The `initKeyboardEvent()` method."]
118    #[doc = ""]
119    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/initKeyboardEvent)"]
120    #[doc = ""]
121    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`*"]
122    pub fn init_keyboard_event(this: &KeyboardEvent, type_arg: &str) -> Result<(), JsValue>;
123    # [wasm_bindgen (catch , method , structural , js_class = "KeyboardEvent" , js_name = initKeyboardEvent)]
124    #[doc = "The `initKeyboardEvent()` method."]
125    #[doc = ""]
126    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/initKeyboardEvent)"]
127    #[doc = ""]
128    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`*"]
129    pub fn init_keyboard_event_with_bubbles_arg(
130        this: &KeyboardEvent,
131        type_arg: &str,
132        bubbles_arg: bool,
133    ) -> Result<(), JsValue>;
134    # [wasm_bindgen (catch , method , structural , js_class = "KeyboardEvent" , js_name = initKeyboardEvent)]
135    #[doc = "The `initKeyboardEvent()` method."]
136    #[doc = ""]
137    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/initKeyboardEvent)"]
138    #[doc = ""]
139    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`*"]
140    pub fn init_keyboard_event_with_bubbles_arg_and_cancelable_arg(
141        this: &KeyboardEvent,
142        type_arg: &str,
143        bubbles_arg: bool,
144        cancelable_arg: bool,
145    ) -> Result<(), JsValue>;
146    #[cfg(feature = "Window")]
147    # [wasm_bindgen (catch , method , structural , js_class = "KeyboardEvent" , js_name = initKeyboardEvent)]
148    #[doc = "The `initKeyboardEvent()` method."]
149    #[doc = ""]
150    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/initKeyboardEvent)"]
151    #[doc = ""]
152    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`, `Window`*"]
153    pub fn init_keyboard_event_with_bubbles_arg_and_cancelable_arg_and_view_arg(
154        this: &KeyboardEvent,
155        type_arg: &str,
156        bubbles_arg: bool,
157        cancelable_arg: bool,
158        view_arg: Option<&Window>,
159    ) -> Result<(), JsValue>;
160    #[cfg(feature = "Window")]
161    # [wasm_bindgen (catch , method , structural , js_class = "KeyboardEvent" , js_name = initKeyboardEvent)]
162    #[doc = "The `initKeyboardEvent()` method."]
163    #[doc = ""]
164    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/initKeyboardEvent)"]
165    #[doc = ""]
166    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`, `Window`*"]
167    pub fn init_keyboard_event_with_bubbles_arg_and_cancelable_arg_and_view_arg_and_key_arg(
168        this: &KeyboardEvent,
169        type_arg: &str,
170        bubbles_arg: bool,
171        cancelable_arg: bool,
172        view_arg: Option<&Window>,
173        key_arg: &str,
174    ) -> Result<(), JsValue>;
175    #[cfg(feature = "Window")]
176    # [wasm_bindgen (catch , method , structural , js_class = "KeyboardEvent" , js_name = initKeyboardEvent)]
177    #[doc = "The `initKeyboardEvent()` method."]
178    #[doc = ""]
179    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/initKeyboardEvent)"]
180    #[doc = ""]
181    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`, `Window`*"]
182    pub fn init_keyboard_event_with_bubbles_arg_and_cancelable_arg_and_view_arg_and_key_arg_and_location_arg(
183        this: &KeyboardEvent,
184        type_arg: &str,
185        bubbles_arg: bool,
186        cancelable_arg: bool,
187        view_arg: Option<&Window>,
188        key_arg: &str,
189        location_arg: u32,
190    ) -> Result<(), JsValue>;
191    #[cfg(feature = "Window")]
192    # [wasm_bindgen (catch , method , structural , js_class = "KeyboardEvent" , js_name = initKeyboardEvent)]
193    #[doc = "The `initKeyboardEvent()` method."]
194    #[doc = ""]
195    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/initKeyboardEvent)"]
196    #[doc = ""]
197    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`, `Window`*"]
198    pub fn init_keyboard_event_with_bubbles_arg_and_cancelable_arg_and_view_arg_and_key_arg_and_location_arg_and_ctrl_key(
199        this: &KeyboardEvent,
200        type_arg: &str,
201        bubbles_arg: bool,
202        cancelable_arg: bool,
203        view_arg: Option<&Window>,
204        key_arg: &str,
205        location_arg: u32,
206        ctrl_key: bool,
207    ) -> Result<(), JsValue>;
208    #[cfg(feature = "Window")]
209    # [wasm_bindgen (catch , method , structural , js_class = "KeyboardEvent" , js_name = initKeyboardEvent)]
210    #[doc = "The `initKeyboardEvent()` method."]
211    #[doc = ""]
212    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/initKeyboardEvent)"]
213    #[doc = ""]
214    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`, `Window`*"]
215    pub fn init_keyboard_event_with_bubbles_arg_and_cancelable_arg_and_view_arg_and_key_arg_and_location_arg_and_ctrl_key_and_alt_key(
216        this: &KeyboardEvent,
217        type_arg: &str,
218        bubbles_arg: bool,
219        cancelable_arg: bool,
220        view_arg: Option<&Window>,
221        key_arg: &str,
222        location_arg: u32,
223        ctrl_key: bool,
224        alt_key: bool,
225    ) -> Result<(), JsValue>;
226    #[cfg(feature = "Window")]
227    # [wasm_bindgen (catch , method , structural , js_class = "KeyboardEvent" , js_name = initKeyboardEvent)]
228    #[doc = "The `initKeyboardEvent()` method."]
229    #[doc = ""]
230    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/initKeyboardEvent)"]
231    #[doc = ""]
232    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`, `Window`*"]
233    pub fn init_keyboard_event_with_bubbles_arg_and_cancelable_arg_and_view_arg_and_key_arg_and_location_arg_and_ctrl_key_and_alt_key_and_shift_key(
234        this: &KeyboardEvent,
235        type_arg: &str,
236        bubbles_arg: bool,
237        cancelable_arg: bool,
238        view_arg: Option<&Window>,
239        key_arg: &str,
240        location_arg: u32,
241        ctrl_key: bool,
242        alt_key: bool,
243        shift_key: bool,
244    ) -> Result<(), JsValue>;
245    #[cfg(feature = "Window")]
246    # [wasm_bindgen (catch , method , structural , js_class = "KeyboardEvent" , js_name = initKeyboardEvent)]
247    #[doc = "The `initKeyboardEvent()` method."]
248    #[doc = ""]
249    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/initKeyboardEvent)"]
250    #[doc = ""]
251    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`, `Window`*"]
252    pub fn init_keyboard_event_with_bubbles_arg_and_cancelable_arg_and_view_arg_and_key_arg_and_location_arg_and_ctrl_key_and_alt_key_and_shift_key_and_meta_key(
253        this: &KeyboardEvent,
254        type_arg: &str,
255        bubbles_arg: bool,
256        cancelable_arg: bool,
257        view_arg: Option<&Window>,
258        key_arg: &str,
259        location_arg: u32,
260        ctrl_key: bool,
261        alt_key: bool,
262        shift_key: bool,
263        meta_key: bool,
264    ) -> Result<(), JsValue>;
265}
266impl KeyboardEvent {
267    #[doc = "The `KeyboardEvent.DOM_KEY_LOCATION_STANDARD` const."]
268    #[doc = ""]
269    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`*"]
270    pub const DOM_KEY_LOCATION_STANDARD: u32 = 0u64 as u32;
271    #[doc = "The `KeyboardEvent.DOM_KEY_LOCATION_LEFT` const."]
272    #[doc = ""]
273    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`*"]
274    pub const DOM_KEY_LOCATION_LEFT: u32 = 1u64 as u32;
275    #[doc = "The `KeyboardEvent.DOM_KEY_LOCATION_RIGHT` const."]
276    #[doc = ""]
277    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`*"]
278    pub const DOM_KEY_LOCATION_RIGHT: u32 = 2u64 as u32;
279    #[doc = "The `KeyboardEvent.DOM_KEY_LOCATION_NUMPAD` const."]
280    #[doc = ""]
281    #[doc = "*This API requires the following crate features to be activated: `KeyboardEvent`*"]
282    pub const DOM_KEY_LOCATION_NUMPAD: u32 = 3u64 as u32;
283}