Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added WebHID to web-sys #2617

Merged
merged 1 commit into from
Jul 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions crates/web-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,18 @@ HashChangeEvent = ["Event"]
HashChangeEventInit = []
Headers = []
HeadersGuardEnum = []
Hid = ["EventTarget"]
HidCollectionInfo = []
HidConnectionEvent = ["Event"]
HidConnectionEventInit = []
HidDevice = ["EventTarget"]
HidDeviceFilter = []
HidDeviceRequestOptions = []
HidInputReportEvent = ["Event"]
HidInputReportEventInit = []
HidReportInfo = []
HidReportItem = []
HidUnitSystem = []
HiddenPluginEventInit = []
History = []
HitRegionOptions = []
Expand Down Expand Up @@ -923,6 +935,7 @@ ReadableStreamByobReader = []
ReadableStreamDefaultReadResult = []
ReadableStreamDefaultReader = []
ReadableStreamGetReaderOptions = []
ReadableStreamIteratorOptions = []
ReadableStreamReaderMode = []
ReadableWritablePair = []
RecordingState = []
Expand Down Expand Up @@ -1248,7 +1261,7 @@ TouchInit = []
TouchList = []
TrackEvent = ["Event"]
TrackEventInit = []
TransformStream = ["ReadableStream", "WritableStream"]
TransformStream = []
TransitionEvent = ["Event"]
TransitionEventInit = []
Transport = []
Expand Down Expand Up @@ -1319,8 +1332,8 @@ VrSubmitFrameResult = []
VttCue = ["EventTarget", "TextTrackCue"]
VttRegion = []
WakeLock = []
WakeLockSentinel = ["EventTarget"]
WakeLockType = []
WakeLockSentinel = []
WatchAdvertisementsOptions = []
WaveShaperNode = ["AudioNode", "EventTarget"]
WaveShaperOptions = []
Expand Down
85 changes: 85 additions & 0 deletions crates/web-sys/src/features/gen_Hid.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#![allow(unused_imports)]
use super::*;
use wasm_bindgen::prelude::*;
#[cfg(web_sys_unstable_apis)]
#[wasm_bindgen]
extern "C" {
# [wasm_bindgen (extends = EventTarget , extends = :: js_sys :: Object , js_name = HID , typescript_type = "HID")]
#[derive(Debug, Clone, PartialEq, Eq)]
#[doc = "The `Hid` class."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HID)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Hid`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub type Hid;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (structural , method , getter , js_class = "HID" , js_name = onconnect)]
#[doc = "Getter for the `onconnect` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HID/onconnect)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Hid`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn onconnect(this: &Hid) -> Option<::js_sys::Function>;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (structural , method , setter , js_class = "HID" , js_name = onconnect)]
#[doc = "Setter for the `onconnect` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HID/onconnect)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Hid`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn set_onconnect(this: &Hid, value: Option<&::js_sys::Function>);
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (structural , method , getter , js_class = "HID" , js_name = ondisconnect)]
#[doc = "Getter for the `ondisconnect` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HID/ondisconnect)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Hid`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn ondisconnect(this: &Hid) -> Option<::js_sys::Function>;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (structural , method , setter , js_class = "HID" , js_name = ondisconnect)]
#[doc = "Setter for the `ondisconnect` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HID/ondisconnect)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Hid`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn set_ondisconnect(this: &Hid, value: Option<&::js_sys::Function>);
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "HID" , js_name = getDevices)]
#[doc = "The `getDevices()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HID/getDevices)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Hid`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn get_devices(this: &Hid) -> ::js_sys::Promise;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "HidDeviceRequestOptions")]
# [wasm_bindgen (method , structural , js_class = "HID" , js_name = requestDevice)]
#[doc = "The `requestDevice()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HID/requestDevice)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Hid`, `HidDeviceRequestOptions`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn request_device(this: &Hid, options: &HidDeviceRequestOptions) -> ::js_sys::Promise;
}
169 changes: 169 additions & 0 deletions crates/web-sys/src/features/gen_HidCollectionInfo.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
#![allow(unused_imports)]
use super::*;
use wasm_bindgen::prelude::*;
#[cfg(web_sys_unstable_apis)]
#[wasm_bindgen]
extern "C" {
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = HIDCollectionInfo)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[doc = "The `HidCollectionInfo` dictionary."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HidCollectionInfo`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub type HidCollectionInfo;
}
#[cfg(web_sys_unstable_apis)]
impl HidCollectionInfo {
#[doc = "Construct a new `HidCollectionInfo`."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HidCollectionInfo`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn new() -> Self {
#[allow(unused_mut)]
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
ret
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `children` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HidCollectionInfo`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn children(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("children"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `featureReports` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HidCollectionInfo`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn feature_reports(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("featureReports"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `inputReports` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HidCollectionInfo`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn input_reports(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("inputReports"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `outputReports` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HidCollectionInfo`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn output_reports(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("outputReports"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `type` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HidCollectionInfo`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn type_(&mut self, val: u8) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `usage` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HidCollectionInfo`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn usage(&mut self, val: u16) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("usage"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `usagePage` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HidCollectionInfo`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn usage_page(&mut self, val: u16) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("usagePage"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
}
30 changes: 30 additions & 0 deletions crates/web-sys/src/features/gen_HidConnectionEvent.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#![allow(unused_imports)]
use super::*;
use wasm_bindgen::prelude::*;
#[cfg(web_sys_unstable_apis)]
#[wasm_bindgen]
extern "C" {
# [wasm_bindgen (extends = Event , extends = :: js_sys :: Object , js_name = HIDConnectionEvent , typescript_type = "HIDConnectionEvent")]
#[derive(Debug, Clone, PartialEq, Eq)]
#[doc = "The `HidConnectionEvent` class."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HIDConnectionEvent)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HidConnectionEvent`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub type HidConnectionEvent;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "HidDevice")]
# [wasm_bindgen (structural , method , getter , js_class = "HIDConnectionEvent" , js_name = device)]
#[doc = "Getter for the `device` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/HIDConnectionEvent/device)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `HidConnectionEvent`, `HidDevice`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn device(this: &HidConnectionEvent) -> HidDevice;
}
Loading