blob: bec31205212f9639467cdc37aa7bd3254cea86cc [file] [log] [blame]
#![allow(unused_imports)]
use super::*;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = DeviceMotionEventInit)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[doc = "The `DeviceMotionEventInit` dictionary."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`*"]
pub type DeviceMotionEventInit;
}
impl DeviceMotionEventInit {
#[doc = "Construct a new `DeviceMotionEventInit`."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`*"]
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: `DeviceMotionEventInit`*"]
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: `DeviceMotionEventInit`*"]
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: `DeviceMotionEventInit`*"]
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
}
#[cfg(feature = "DeviceAccelerationInit")]
#[doc = "Change the `acceleration` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DeviceAccelerationInit`, `DeviceMotionEventInit`*"]
pub fn acceleration(&mut self, val: &DeviceAccelerationInit) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("acceleration"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[cfg(feature = "DeviceAccelerationInit")]
#[doc = "Change the `accelerationIncludingGravity` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DeviceAccelerationInit`, `DeviceMotionEventInit`*"]
pub fn acceleration_including_gravity(&mut self, val: &DeviceAccelerationInit) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("accelerationIncludingGravity"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `interval` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`*"]
pub fn interval(&mut self, val: Option<f64>) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("interval"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[cfg(feature = "DeviceRotationRateInit")]
#[doc = "Change the `rotationRate` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DeviceMotionEventInit`, `DeviceRotationRateInit`*"]
pub fn rotation_rate(&mut self, val: &DeviceRotationRateInit) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("rotationRate"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
}
impl Default for DeviceMotionEventInit {
fn default() -> Self {
Self::new()
}
}