blob: a1ec1ae2e13bc655609e4ab1b53c2c77b4917bc7 [file] [log] [blame]
#![allow(unused_imports)]
use super::*;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = KeyboardEventInit)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[doc = "The `KeyboardEventInit` dictionary."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub type KeyboardEventInit;
}
impl KeyboardEventInit {
#[doc = "Construct a new `KeyboardEventInit`."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn new() -> Self {
#[allow(unused_mut)]
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
ret
}
#[doc = "Change the `bubbles` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn bubbles(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("bubbles"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `cancelable` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn cancelable(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("cancelable"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `composed` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn composed(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("composed"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `detail` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn detail(&mut self, val: i32) -> &mut Self {
use wasm_bindgen::JsValue;
let r =
::js_sys::Reflect::set(self.as_ref(), &JsValue::from("detail"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[cfg(feature = "Window")]
#[doc = "Change the `view` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`, `Window`*"]
pub fn view(&mut self, val: Option<&Window>) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("view"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `altKey` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn alt_key(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r =
::js_sys::Reflect::set(self.as_ref(), &JsValue::from("altKey"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `ctrlKey` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn ctrl_key(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("ctrlKey"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `metaKey` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn meta_key(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("metaKey"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `modifierAltGraph` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn modifier_alt_graph(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("modifierAltGraph"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `modifierCapsLock` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn modifier_caps_lock(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("modifierCapsLock"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `modifierFn` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn modifier_fn(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("modifierFn"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `modifierFnLock` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn modifier_fn_lock(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("modifierFnLock"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `modifierNumLock` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn modifier_num_lock(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("modifierNumLock"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `modifierOS` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn modifier_os(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("modifierOS"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `modifierScrollLock` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn modifier_scroll_lock(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("modifierScrollLock"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `modifierSymbol` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn modifier_symbol(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("modifierSymbol"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `modifierSymbolLock` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn modifier_symbol_lock(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("modifierSymbolLock"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `shiftKey` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn shift_key(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("shiftKey"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `charCode` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn char_code(&mut self, val: u32) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("charCode"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `code` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn code(&mut self, val: &str) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("code"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `isComposing` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn is_composing(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("isComposing"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `key` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn key(&mut self, val: &str) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("key"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `keyCode` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn key_code(&mut self, val: u32) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("keyCode"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `location` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn location(&mut self, val: u32) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("location"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `repeat` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn repeat(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r =
::js_sys::Reflect::set(self.as_ref(), &JsValue::from("repeat"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `which` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `KeyboardEventInit`*"]
pub fn which(&mut self, val: u32) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("which"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
}
impl Default for KeyboardEventInit {
fn default() -> Self {
Self::new()
}
}